function to convert date format

Asked By rajani maski
09-Feb-10 12:55 AM
Earn up to 0 extra points for answering this tough question.
hi...
please can anyone let me know how the iso date formats to be converted into regular readable format?
eg: 1985102,1985W155 to be converted into 1985 april 12th friday.Code in c# or any easiest logic to get this.. hi...
please can anyone let me know how the iso date formats to be converted into regular readable format?
eg: 1985102,1985W155 to be converted into 1985 april 12th friday.Code in c# or any easiest logic to get this..

  re: function to convert date format

Santhosh N replied to rajani maski
09-Feb-10 01:06 AM
You can format the date in c# using .ToString("format of Date") on datetime variable

for Ex:
DateTime dt = new DateTime(2009, 10, 10);
dt.ToString("D", CultureInfo.CreateSpecificCulture("en-US"))

this will display as DayOf the Week, Month 10, 2008 
check here for more info and other formats                      

  re: function to convert date format

Sakshi a replied to rajani maski
09-Feb-10 01:18 AM
see this. It has all format conversions like ISO,etc.

  re: function to convert date format

Sakshi a replied to rajani maski
09-Feb-10 01:18 AM
see this. It has all format conversions like ISO,etc.
  re: re: function to convert date format
rajani maski replied to Santhosh N
09-Feb-10 01:22 AM
hi..thanks lot for reply..:)
 
I needed to know if i give input as say 1985W155 that is year 1985 week15th 5th day..or
1985102..that is 102th day of year 1985...I want display as "april 12th 1985 friday"

What code or function shall i write to get that output for said input that is in isodate format?
Awaiting your reply.
rajani@pointcross.com
  re: re: function to convert date format
rajani maski replied to Sakshi a
09-Feb-10 01:28 AM
hi sakshi...Thankyou for link...but that is not solving my problem..i need to convert date formats not the representation formats..Eg: if i give input as 102th day of 1985...i need output as april 12th 1985,friday"  like wise..for 1985W155..its week15th 5thday of 1985...which must give op as "april 12th 1985,friday"


Awaiting reply
rajani@pointcross.com
  re: re: re: function to convert date format
Anoop S replied to rajani maski
09-Feb-10 02:49 AM
assume input as string and check the length of string and  if its 7 the the write the code for that-eg 1985102,- add 102 ads using datetime.adddays(102) and string length 8(1985W155) the extract the string (0-3)-1985, st(5-6) -15, st7-5, then multiply 17* 7 + add days the use above method to add days,  there will be some easier methods other than this, lets check method in DateTime.UtcNow. function 
  re: re: re: re: function to convert date format
Anoop S replied to Anoop S
09-Feb-10 02:55 AM
method in DateTime.UtcNow. function => DateTime.UtcNow (no option for edit )
  re: re: re: re: function to convert date format
rajani maski replied to Anoop S
09-Feb-10 03:45 AM
hello anoop..Thanks for the reply..Yeah i have applied the same methd that u said...but its being lengtheir..And there are n number of iso formats like that..To convert them into regular readable format is being hectic task..neways,if u find any simpler way..pls lemme know...

awaiting answer..
Regards,
Rajani Maski
  re: re: re: function to convert date format
Sakshi a replied to rajani maski
09-Feb-10 03:53 AM
for that u need to write custom code.
  re: re: re: function to convert date format
Santhosh N replied to rajani maski
09-Feb-10 04:17 AM
you can check the custom formats here and if your input dates matches any of the formats and culture specific formats you could convert them appropriately..
http://msdn.microsoft.com/en-us/library/8kb3ddd4.aspx
other than that, I am afraid you need to corret the source dates or apply your custom logic...
  re: re: re: re: function to convert date format
rajani maski replied to Santhosh N
09-Feb-10 04:30 AM
ok...how to write custom code? pl jus gimme lil xample..ill continue it than...
  re: re: re: re: re: function to convert date format
Santhosh N replied to rajani maski
09-Feb-10 09:42 AM
plz read in detail the link, it has the info...

and let me know for further info
Create New Account