ExtensionMethod.NET Home of 880 C#, Visual Basic, F# and Javascript extension methods

ToReversedDateTime

Takes a DateTime object and reverses it to an SQL type string (yyyy-mm-dd hh:MM:ss)

Source

internal static string ToReversedDateTime(this DateTime value)
{
    return string.Format("{0:u}", value);
}

Example

string reversed = DateTime.Now.ToReversedDateTime();

Author: Jon Preece

Submitted on: 25 okt. 2010

Language: C#

Type: System.String

Views: 4678