日期在vb.net代码中使用数组 [英] date using array in vb.net code

查看:108
本文介绍了日期在vb.net代码中使用数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



您能建议我,如何使用vb.net代码中的数组从任何日期中查找日期.

谢谢
Refeesh

Hi,

can you advice me, how to find day from any date using array in vb.net code.

Thanks
Refeesh

推荐答案

为什么要使用数组?只需将其创建为DateTime,它将(几乎)为您提供所有您需要的信息:
Why would you use an array? Just create it as a DateTime, and it will give you (nearly) all the information you could want:
Dim dt As DateTime = DateTime.Parse("20/12/2011")
Console.WriteLine(dt.DayOfWeek)


i在数组中应用于查找日期名称.

私有子Button2_Click(ByVal发送者为System.Object,ByVal e为System.EventArgs)处理Button2.Click

Dim daydply As String ="
昏暗的arr(6)作为字符串
arr(0)=星期天"
arr(1)=星期一"
arr(2)=星期二"
arr(3)=星期三"
arr(4)=星期四"
arr(5)=星期五"
arr(6)=星期六"

Dim dt As DateTime = DateTime.Parse("28/02/2011")
daydply =(dt.DayOfWeek)

TextBox1.Text = arr(daydply)

结束Sub
i applied in array to find dayname.

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click

Dim daydply As String = ""
Dim arr(6) As String
arr(0) = "Sunday"
arr(1) = "Monday"
arr(2) = "Thuesday"
arr(3) = "Wednesday"
arr(4) = "Thursday"
arr(5) = "Friday"
arr(6) = "Saturday"

Dim dt As DateTime = DateTime.Parse("28/02/2011")
daydply = (dt.DayOfWeek)

TextBox1.Text = arr(daydply)

End Sub


这篇关于日期在vb.net代码中使用数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆