Something to remember, in programming in multiple site environment, if you have site that has differ time zone than the server time zone, remember to use GetSiteDate function, instead of directly GETDATE(). Below is code sample.
SET @PrintDate = dbo.GetSiteDate(GETDATE())
It is very often that you need to get current date/time in your development.
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)
System.DateTime.Now.ToString(“yyyyMMddhhmmss”)
Now()
To initiate a date field as today’s date in Syteline form, need to use CURDATE().
Recent Comments