Discussion
This Page: DevCenter/Projects/MetaTags
Originator: BenAllums
Created on: 2009-05-29 22:49:16
I also wanted to direct you to Microsoft's documentation for formatting strings with C#/.Net:
Basically, you can alter/replace "String.Format()" with the available options:
- result = String.Format("{0:r}", dateTime);
I'd recommend that you copy the TicksAsRFC1123() function, rename it, and play with the format options.
public string TicksAsRFC1123(long ticks)
{
string result;
DateTime dateTime;
dateTime = new DateTime(ticks);
result = String.Format("{0:r}", dateTime);
return result;
}
public string TicksAsMyFormat(long ticks)
{
string result;
DateTime dateTime;
dateTime = new DateTime(ticks);
result = String.Format("{0:d}", dateTime);
return result;
}-- BenAllums
To add to Ben's note, if you use:
public string TicksAsMyFormat(long ticks)
{
string result;
DateTime dateTime;
dateTime = new DateTime(ticks);
result = String.Format("{0:d}", dateTime);
return result;note specifically the {0:d}, your date format will simply be mm/dd/yyyy. The "d", rather than the "r" makes the difference.
-- Marsha Lofthouse