Saturday, November 7, 2009

SQL datetime headaches

I'm always hassleing with datetimes in the SQL Server database to get the correct datetime format that i want. It seems that most of this stuff you can do with specifying a format when converting it:
Usefull page for that

But it did not realy have what i wanted from it.

So the final solution was the following
to get a format like this:
2008-11-13 17:29:00

I needed to do the following

SET generated = cast( getdate() - 8 as smalldatetime)

No comments:

Post a Comment