zoukankan      html  css  js  c++  java
  • [学习日记]vb.net里的两个重要的时间函数

    从别人那里看来的,为了方便,放在自己这里,经常会用到的

    函数Dateadd() 
     功能:计算某个指定的时间和 
     格式: dateadd(timeinterval,number,date) 
     参数:timeinterval是时间单位(月,日..); number是时间间隔值,date是时间始点. 
     例子: 
     <% 
     currentDate = #8/4/99# 
     newDate = DateAdd(“m”,3,currentDate) 
     response.write newDate 
     %> <% 
     currentDate = #12:34:45 PM# 
     newDate = DateAdd(“h”,3,currentDate) 
     response.write newDate 
     %> 
     结果: 
     11/4/99 
     3:34:45 PM 
     其中 
     “m” = ”month”; 
     “d” = ”day”; 
     如果是currentDate 格式,则, 
     “h” = ”hour”; 
     “s” = ”second”;
      
     函数Datediff() 
     功能:计算某量个指定的时间差 
     格式: datediff(timeinterval,date1,date2[,firstdayofweek[,firstdayofyear]]) 
     参数: timeinterval 是时间单位; date1,date2是有效的日期表达式,firstdayofweek,firstdayofyear 是任意选项. 
     例子: 
     <% 
     fromDate = #8/4/99# 
     toDate = #1/1/2000# 
     response.write ”There are ” & _ 
     DateDiff(“d”,fromDate,toDate) & _ 
     “ days to millenium from 8/4/99.” 
     %> 
     结果:There are 150 days to millenium from 8/4/99. 
  • 相关阅读:
    867-转置矩阵
    704-二分查找
    选择排序
    999-车的可用捕获量
    66-加一
    观察者模式(1)
    命令模式(3)-宏命令
    命令模式(2)-命令接口中的撤销方法
    接口测试
    移动端测试
  • 原文地址:https://www.cnblogs.com/aowind/p/111858.html
Copyright © 2011-2022 走看看