用基于vb的asp.net编写显示当前日期时间和星期几的代码怎么写?急用C#
string [] Day=new string []{"星期日","星期一","星期二","星期三","星期四","星期五","星期六"};
Console.WriteLine(Day[Convert.ToInt16(DateTime.Now.DayOfWeek)]);
相信VB.net的你 , 应该懂的 。
vb.net中如何获取当前日期所在星期的星期一的具体年月日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")'获取当前日期的年份
【vb.net当前系统星期 vb窗体启动时显示日期信息】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)
vb.net中如何获取当前日期所在星期的星期一1
string[] Day = new string[] { "星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六" };
string week = Day[Convert.ToInt32(DateTime.Now.DayOfWeek.ToString("d"))].ToString();
this.lbDay.Text = week;
2
this.lbDay.Text = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetDayName(DateTime.Now.DayOfWeek);
vb.net当前系统星期的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vb窗体启动时显示日期信息、vb.net当前系统星期的信息别忘了在本站进行查找喔 。
推荐阅读
- android4.4html5的简单介绍
- css加载字体解密,css 加载
- excel表格数字怎么排序,excel表格数字怎么排序成自己想要的顺序
- .net网站地图文件的用法,网站地图可以加入到什么文件中
- 区块链最好语言是go吗 区块链用的什么语言
- 红警免费下载,红警免费下载电脑版教程
- 电脑版休闲单机游戏,电脑好玩的单机休闲游戏
- ip代理换ip软件,代理ip切换工具
- ftp命令重启linux的简单介绍