十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
vb中获取系统当前的时间用函数 now() 就可以。另外还有相关的时间 date() time()\x0d\x0anow()获取系统当前日期和时间,如:2015-12-12 22:23:34\x0d\x0atime()获取厅枝卖扮逗系统的时间,如:22:23:34不显示当前日期搭汪\x0d\x0adate()获得系统的日期,如:2015-12-12\x0d\x0a\x0d\x0aPrivate Sub Command1_Click()\x0d\x0aMsgBox Now()\x0d\x0aMsgBox Time()\x0d\x0aMsgBox Date\x0d\x0aEnd Sub
创新互联公司专注于沙雅企业网站建设,响应式网站建设,电子商务商城网站建设。沙雅网站建设公司,为沙雅等地区提供建站服务。全流程按需开发网站,专业设计,全程项目跟踪,创新互联公司专业和态度为您提供的服务
dim myMonth as string= DateTime.Now.tostring("正型MM")
年月日时分秒
DateTime.Now.tostring("yyyy-MM-dd hh-dd-ss") ‘得到2011-03-30 09-08-05
DateTime.Now.tostring("yy-M-d h-d-s") ‘得敬清顷亮陆到11-3-30 9-8-5
Dim ThisDay As String = Format(Now, "yyyy-MM-dd") '获得当前日期字符串
Dim ThisDateTime As DateTime = Convert.ToDateTime(ThisDay) '当前日期搭蚂颤转换成DateTime
Dim ThisWeekDay As Integer = ThisDateTime.DayOfWeek '获得当前日期是星期几
Dim differadd As Integer = 1 - ThisWeekDay '相差物坦的天数(星期1与当前星期几相差的天数)
Dim MyAdd As New TimeSpan(differadd, 0, 0, 0)
Dim MyYear As Integer = Format(Now, "yyyy") '获取当前日期的年份
Dim MyMonth As Integer = Format(Now, "MM") '获取当前日期的月份
Dim MyDay As Integer = Format(Now, "dd"知败) '获取当前日期是几号
Dim MyToday As DateTime = New DateTime(MyYear, MyMonth, MyDay)
Dim Yourday As DateTime = MyToday.Add(MyAdd)
MsgBox("本周星期一的日期是:" Yourday)