VB.NET中有哪些时间函数

发布时间:2021-07-14 14:55:08 作者:Leah
来源:亿速云 阅读:109

本篇文章给大家分享的是有关VB.NET中有哪些时间函数,小编觉得挺实用的,因此分享给大家学习,希望大家阅读完这篇文章后可以有所收获,话不多说,跟着小编一起来看看吧。

VB.NET时间函数之函数Dateadd() 

功能:计算某个指定的时间和 

格式: dateadd(timeinterval,number,date) 

参数:timeinterval是时间单位(月,日..); number是时间间隔值,date是时间始点. 

例子: 

  1. < %    

  2. currentDate = #8/4/99#    

  3. newDate = DateAdd
    (“m”,3,currentDate)    

  4. response.write newDate    

  5. %>   

  6. < %currentDate = 
    #12:34:45 PM#    

  7. newDate = DateAdd
    (“h”,3,currentDate)    

  8. response.write newDate    

  9. %>   

结果: 
11/4/99 
3:34:45 PM 
其中 
“m” = ”month”; 
“d” = ”day”; 
如果是currentDate 格式,则, 
“h” = ”hour”; 
“s” = ”second”;
 
VB.NET时间函数之函数Datediff() 

功能:计算某量个指定的时间差 

格式: datediff(timeinterval,date1,date2[,firstdayofweek[,firstdayofyear]]) 

参数: timeinterval 是时间单位; date1,date2是有效的日期表达式,firstdayofweek,firstdayofyear 是任意选项. 

例子: 

  1. < %fromDate = #8/4/99#    

  2. toDate = #1/1/2000#    

  3. response.write ”There 
    are ” & _    

  4. DateDiff(“d”,fromDate,
    toDate) & _    

  5. “ days to millenium 
    from 8/4/99.”    

  6. %>   

结果:There are 150 days to millenium from 8/4/99. 

以上就是VB.NET中有哪些时间函数,小编相信有部分知识点可能是我们日常工作会见到或用到的。希望你能通过这篇文章学到更多知识。更多详情敬请关注亿速云行业资讯频道。

推荐阅读:
  1. MySQL 时间函数
  2. mysql中有哪些时间函数

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

vb.net

上一篇:css有哪几种颜色写法

下一篇:css如何删除滚动条

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》