date conversion

  • Thread starter Thread starter Reb
  • Start date Start date
R

Reb

Hi,

How do i convert this "Sun Jun 29 00:00:00 UTC 0800 2003"
to the normal date format (mm/dd/yyyy).

Thanks
Reb
 
Reb said:
How do i convert this "Sun Jun 29 00:00:00 UTC 0800 2003"
to the normal date format (mm/dd/yyyy).

Use DateTime.Parse and one of the DateTime.ToString variants.

Look up "Date and Time Format Strings" in the MSDN for more
information.
 
hi Jon,

I tried to do this method. But looks like, it couldn't
recognise the format.

CultureInfo en = new CultureInfo("en-US");
String format = "MM/dd/yyyy hh:mm:sszzz";

// Converts the string back to a local DateTime and
displays it.
DateTime parsedBack =
DateTime.ParseExact(day,format,en.DateTimeFormat);

have u come across this before?
thx
Reb
 
reb said:
I tried to do this method. But looks like, it couldn't
recognise the format.

CultureInfo en = new CultureInfo("en-US");
String format = "MM/dd/yyyy hh:mm:sszzz";

// Converts the string back to a local DateTime and
displays it.
DateTime parsedBack =
DateTime.ParseExact(day,format,en.DateTimeFormat);

have u come across this before?

Well, if you're trying to convert *from*
"Sun Jun 29 00:00:00 UTC 0800 2003" then the pattern you gave above
certainly won't work - you need to parse with one pattern and then
format with another.
 
Back
Top