For the MM / DD / YY format :
public static long DateToLong(DateTime date) {
return date.Month * 1000000 + date.Day * 10000 + date.Year;
}
public static DateTime LongToDate(long date_as_long) {
return new DateTime((int) date_as_long % 10000, (int) date_as_long /
1000000, (int) (date_as_long / 10000) % 100);
}
Example :
Console.WriteLine("{0}", DateToLong(new DateTime(2004,4,28)));
Console.WriteLine("{0}", LongToDate(04282004).ToShortDateString());
The others will be very similar, you will only have to change the
calculations a bit depending on the position you want the different parts of
the date in the long.
Yves
"Kit" <an*******@discussions.microsoft.com> schreef in bericht
news:E0**********************************@microsof t.com...
Thanks for ur reply
I'm using C# , i want date in all the possible formats(MM/DD/YYYY ....)
Thanks in advance