Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 CONVERT or CAST from smalldatetime

Author  Topic 

sangoku
Starting Member

19 Posts

Posted - 2009-09-04 : 05:42:35
Hy there i have a lithe bit of uncertainty,

I made a row in a table type smalldatetime BUT it is in the US standard i need to convert it to the standard EU format dd.mm.yyyy. can someone help me out please. In advise thank you

while earth still spining
live on, have fun
else
move to mars

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-04 : 05:56:30
Formation matters only if you want to show them in front end application.
When sending dates to table, send them in YYYYMMDD HH:MM:SS format

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-09-04 : 05:59:00
Inside the table there is no format like US or EU or what else.
The wanted format is to do in your front end.
For example you can do
set language german
and then select your date column.


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2009-09-04 : 05:59:24



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

sangoku
Starting Member

19 Posts

Posted - 2009-09-04 : 06:00:02
Yes i know, but i have a test today and i used this db for my test and i fear he will ask me to convert it i already tried it but i always get the value in the format i inserted it,, like this:


SELECT CONVERT(smalldatetime, (SELECT Nastao FROM Tema WHERE IdTeme = 19),3)

No mather which standard i use it always returns the value i originally inserted into table like 2009-09-01 23:38:00 instead of 1.9.2009 QQ

while earth still spining
live on, have fun
else
move to mars
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-04 : 06:01:41
Please read my reply again

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

sangoku
Starting Member

19 Posts

Posted - 2009-09-04 : 06:35:29
Yes by the time i typed the reply you guys all answered you guys flooded the post with posts.i got it now... When you convert it to a s trring THEN you get it in the format you want. sorry for the misinformed post... i am still learning

while earth still spining
live on, have fun
else
move to mars
Go to Top of Page
   

- Advertisement -