Archives

Posts Tagged ‘VB .Net’

Use CDate to convert a string to a date/time. Dim d1 As Date Dim d2 As Date Dim d3 As Date d1 = CDate(“August 12, 2004”) d2 = CDate(“2:07:30 PM”) d3 = CDate(“August 12, 2004 2:07:30 PM”) Print d1 ‘ prints 8/12/2004 Print d2 ‘ prints 2:07:30 PM Print d3 ‘ prints 8/12/2004 2:07:30 PM

Feb 4th, 2009 | Filed under Development, VB .Net

It is very often that you need to get current date/time in your development. T-SQL To get today date without time as string variable use following script: Select CONVERT( CHAR(8), GetDate(), 112) To get datetime variable of today date without time use following script: Select CAST( CONVERT( CHAR(8), GetDate(), 112) AS DATETIME) VB System.DateTime.Now.ToString(“yyyyMMddhhmmss”) Now() […]

Jan 24th, 2009 | Filed under Development, SQL, VB .Net