Home > Development, SQL, VB .Net > Today’s Date

Today’s Date

January 24th, 2009 Leave a comment Go to comments

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()

To initiate a date field as today’s date in Syteline form, need to use CURDATE().

  1. No comments yet.
  1. No trackbacks yet.
You must be logged in to post a comment.