本月的第一个星期天 [英] 1st Sunday of the month

查看:102
本文介绍了本月的第一个星期天的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在设置复选框以取消选中并检查夏令时时遇到问题。首先,我尝试将其链接到time.convert但无法解决。所以现在我已经设置了一个If - Then语句来查找月份,现在我只需要找到本月的第一个星期日,一切都会好的。
哦,顺便说一下这个夏令时在不同的区域到该程序将被使用的地方。
有人可以帮帮我。
谢谢。
Arg。

解决方案

试试这个......

Dim ur_year as int
ur_year = 2009
For x As Integer = 1 To 12
Dim newDate As DateTime = New DateTime(ur_year,x,1)
newDate。 DayOfWeek<> DayOfWeek.Sunday















>

I am having problems setting up a checkbox to uncheck and check for daylight savings. First I tried to link it into the time.convert but couldn't work it out. So now I have set an If - Then statement to find the months and now i just need to find the first Sunday of the month and all will be good.
Oh, by the way this daylight savings is in a different zone to where the program will be used.
Can someone help me out please.
Thank you.
Arg.

解决方案

Try this... 

       Dim ur_year as int
       ur_year = 2009
       For x As Integer = 1 To 12
            Dim newDate As DateTime = New DateTime(ur_year, x, 1)
            While newDate.DayOfWeek <> DayOfWeek.Sunday
                newDate = newDate.AddDays(1)
            End While
            Debug.WriteLine(newDate.ToLongDateString)
        Next

Regards,
Navin Narayan


这篇关于本月的第一个星期天的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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