Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / General / August 2006

Tip: Looking for answers? Try searching our database.

XML Date Time

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Jeff Uchtman - 31 Aug 2006 04:32 GMT
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
Jon Shemitz - 31 Aug 2006 05:14 GMT

> 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();
> }

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.