|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Get day name given year, month and day numberHmm.
Is there a way to get the day name (ie Monday) given a year, month and day number? Thanks, Chris You could do something like.
create your date DateTime date = DateTime.Parse("08/24/2006"); string dateString = date.ToLongDateString(); dateString will contain the day name and you should be able to parse it out of there. -Jon Show quote "Stupid48" <cf_r***@hotmail.com> wrote in message news:1156448859.077153.145110@m73g2000cwd.googlegroups.com... > Hmm. > > Is there a way to get the day name (ie Monday) given a year, month and > day number? > > Thanks, > > Chris > Stupid48 wrote:
> Hmm. using System;> > Is there a way to get the day name (ie Monday) given a year, month and > day number? using System.Globalization; // ... DateTime dt = new DateTime(year,month.day); DayOfWeek dow = dt.DayOfWeek; // DayOfWeek is an enum // To get the localized day name... DateTimeFormatInfo dfi = CultureInfo.CurrentCulture; string dayName = dfi.DayNames[dow]; -cd |
|||||||||||||||||||||||