Link to home
Start Free TrialLog in
Avatar of VBdotnet2005
VBdotnet2005Flag for United States of America

asked on

getdate format

On Getdate(), how can I return it as 2011-11-30 00:00:00.000 instead of
2011-11-30 10:27:06.130?
Avatar of sammySeltzer
sammySeltzer
Flag of United States of America image

How about:

CONVERT(char(10), Getdate(), 101)
Sorry, what I gave you won't work.

Change your data type from dateTime to smalldatetime and that will fix it.
SOLUTION
Avatar of tim_cs
tim_cs
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Anthony Perkins
You are confusing the output you see in a client tool such as SSMS with reality:  Getdate() returns a datetime data type and datetime data types do not have any format.
As everyone else has suggested you can certainly CONVERT the output to a varchar with the format you like, but that is not a datetime value.