十年网站开发经验 + 多家企业客户 + 靠谱的建站团队
量身定制 + 运营维护+专业推广+无忧售后,网站问题一站解决
可以访问注册表HKEY_CURRENT_USER\Control Panel\International下面的一些键值
创新互联是一家专业提供保康企业网站建设,专注与网站建设、做网站、成都h5网站建设、小程序制作等业务。10年已为保康众多企业、政府机构等服务。创新互联专业网站建设公司优惠进行中。
如sShortDate键值表示的是短日期sLongDate表示的是长日期
中文下的短日期是 yyyy-M-d
中文下的长日期是 yyyy'年'M'月'd'日'
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)
日期字段用 format 格式化:
format(field1,"yyyy-mm-dd")
后面的格式要看实际情况修改
combobox1'年
combobox2'月
combobox3'日
trim(combobox1.text) trim(combobox2.text) trim(combobox3.text)
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)
用TIMER控件调用NOW函数,可取得系统的日期和时间:
Private Sub Timer1_Timer()
Text1 = Now
End Sub