Matrix001
Matrix001

Reputation: 1272

Question about SQL function GETDATE()

When I insert time with that sql function and get the time out with a select time to present it.. it gives me time in an American way: 6/28/2009 instead of the European way that i want 28/06/2009. Is there a quick way to convert between the times.

And another question will i have a problem when i convert the time to DateTime instead of converting to other Time objects such as ... DateTimeOffset

Upvotes: 2

Views: 373

Answers (2)

Kirill Polishchuk
Kirill Polishchuk

Reputation: 56162

Look at Convert function

Upvotes: 0

Kerrek SB
Kerrek SB

Reputation: 476990

Use the DATE_FORMAT SQL function. Instead of SELECT date FROM mytable;, say SELECT DATE_FORMAT(date, ...) AS mydate FROM mytable;. You can configure the date formatting freely in analogy to date(1) on Linux.

The inverse function is STR_TO_DATE.

Upvotes: 4

Related Questions