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
 SQL Server 2000 Forums
 SQL Server Development (2000)
 datetime field default value

Author  Topic 

Rei
Starting Member

1 Post

Posted - 2002-03-06 : 21:10:21
I am aware of the method
GetDate()
to set the default value for a datetime field, but is there to get a different format other than what has been set in the regional settings for the computer eg. ddd/mm/yyyy instead of d/mm/yyyy hh:mm:ss am/pm ?

I have heard that it may be possible to use the
convert()
method... eg.
convert(varchar, getdate(), 101)
where 101 is the code for the style and it gets converted to a varchar. However, I want to keep it in date format but have the possibility to use different styles.

Anyone know how to achieve this and where I can get a list of style codes from?

Rei.


Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-03-06 : 21:19:18
Make GetDate the default value and do your conversions when you select and display your data.

You shouldn't worry about how SQL Server stores it's dates. Just make them look right in your display layer.

Damian
Go to Top of Page

Merkin
Funky Drop Bear Fearing SQL Dude!

4970 Posts

Posted - 2002-03-06 : 21:20:11
As for style codes.
They are in books online under "Convert"

Damian
Go to Top of Page
   

- Advertisement -