|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
You don't need a fax machine to get faxes. Get a fax-to-email fax number from CallWave. Try it free.
|
|
#1
|
|||
|
|||
|
date function
How do I change this function so that it shows dates like this 2003-05-03 and not 2003-5-3?
And I also want to add a parameter so that the user can choose if it should show : 2003-03-03 or 03-03-03 create function ShowDate(@indate datetime, @separator char(1)) returns nchar(20) as begin return convert(nvarchar(20), datepart(yyyy, @indate)) + @separator + convert(nvarchar(20), datepart(mm, @indate)) + @separator + convert(nvarchar(20), datepart(dd, @indate)) end |
|
#2
|
||||
|
||||
|
this will get your date the way you want it, except it uses . instead of - as a seperator. what programming language are you using to display this data?
select convert(varchar(20),date_field,102) as 'date' from table_name
__________________
My brain cells are like a storm trooper's armor: useless |
|
#3
|
|||
|
|||
|
I solved my problem by sitting up all night, but thanks for your input!
|
![]() |
| Viewing: Dev Shed Forums > Databases > MS SQL Development > date function |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|