[thelist] ASP.NET - Date Logic Question in VB !!
Ken Schaefer
ken at adOpenStatic.com
Thu Oct 7 18:30:14 CDT 2004
----- Original Message -----
From: "Casey Crookston" <casey at thecrookstons.com>
Subject: Re: [thelist] ASP.NET - Date Logic Question in VB !!
: > Use DateTime.DayOfWeek to give you the number of the current
: > day, then it's easy to derive the date of the previous Monday
: > from that by simple subtraction, e.g. (C#):
: >
: > DateTime dtToday = DateTime.Now;
: > DateTime dtMonday = dtToday.AddDays(1-dtToday.DayOfWeek);
: >
:
: How would that look in VB? Which bring up another question... I'll start
a
: new thread.
:
: Casey
Something like:
Dim dtToday As DateTime = DateTime.Now
Dim dtMonday As DateTime = dtToday.AddDays(1-dtToday.DayOfWeek)
-or (more verbosely) -
Dim dtToday As DateTime
Dim dtMonday As DateTime
dtToday = DateTime.Now()
dtMonday = dtToday.AddDays(1-dtToday.DayOfWeek)
Note that there are some slight syntactic differences between VB.NET and C#,
but the manipulation of the DateTime type is exactly the same.
Cheers
Ken
More information about the thelist
mailing list