A collegue of mine (his blog here) showed me something nice yesterday. We have a webpart which shows how long ago some list items where created by simply getting the DateTime string from the standard “Created” column.
string x = ((DateTime)item[SPBuiltInFieldId.Created]).ToString();
We ran into trouble however, when we used this webpart on a server in a country using a different time format. The problem was easily fixed like so:
string x = ((DateTime)item[SPBuiltInFieldId.Created]).ToString(“s”);
Here is a list of other formats you can get with this method by simply replacing the “s” with another letter.