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

ToOracleSqlDate

Converts a Timestamp to a String which can be used in a Oracle SQL Query

Source

public static string ToOracleSqlDate(this DateTime dateTime)
{
 return String.Format("to_date('{0}','dd.mm.yyyy hh24.mi.ss')", dateTime.ToString("dd.MM.yyyy HH:mm:ss"));
}

Example

DateTime.Now.ToOracleSqlDate()

Author: csonic

Submitted on: 19 jan. 2012

Language: C#

Type: System.DateTime

Views: 5532