Not sure if this is the right group. Have a XML wiht date coming in the
following format:
<date_MMDDYYYY>
Have a function pulling numbers
function getDate(d) {
return d.slice(5,7) + '/' + d.slice(7,9) + '/' + d.slice(9);
}
Would like to convert to long date, i.e August 29, 2006.
Any help?
Thanks
Jeff
Thanks
Jeff
> Not sure if this is the right group. Have a XML wiht date coming in the
> following format:
[quoted text clipped - 7 lines]
>
> Would like to convert to long date, i.e August 29, 2006.
Look at the DateTime struct. There's a constructor that takes year,
month, day as integers. You can then return the DateTime's
ToString("D"), or ToLongDateString.
Untested code that assumes it has valid input:
function string GetDate(string date_MMDDYYYY)
{
int Year = Convert.ToInt32(date_MMDDYYYY.Substring(9, 4));
int Month = Convert.ToInt32(date_MMDDYYYY.Substring(5, 2));
int Day = Convert.ToInt32(date_MMDDYYYY.Substring(7, 2));
DateTime Date = new DateTime(Year, Month, Day);
return Date.ToLongDateString();
}

Signature
.NET 2.0 for Delphi Programmers www.midnightbeach.com/.net
Delphi skills make .NET easy to learn In print, in stores.
Jeff Uchtman - 31 Aug 2006 06:15 GMT
Perfect! Thanks!
Jeff
>> Not sure if this is the right group. Have a XML wiht date coming in the
>> following format:
[quoted text clipped - 22 lines]
> return Date.ToLongDateString();
> }