Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql server 2000 date format 2

Status
Not open for further replies.

tempo1

Programmer
Feb 20, 2007
118
Hi everyone,
I want to dispay a date column as a string so i write:
Code:
CONVERT(VARCHAR(12),mydate,101) "date_of_birth"
and recieve a string that contains a date with the format:
mm/dd/yy. Is it possible to show the date (inside a string
column) in a format of: dd/mm/yy ? how ?
Thanks.
 
Use 3 (without century) or 103 (with century) instead of 101



Hope this helps

[vampire][bat]
 
Hi Tempo,

This will give you a full list of conversions and the output if you want to do other things in future

Code:
select
    convert(varchar, GetDate(), 100) as '100 Conversion',
    convert(varchar, GetDate(), 101) as '101 Conversion',
    convert(varchar, GetDate(), 102) as '102 Conversion',
    convert(varchar, GetDate(), 103) as '103 Conversion',
    convert(varchar, GetDate(), 104) as '104 Conversion',
    convert(varchar, GetDate(), 105) as '105 Conversion',
    convert(varchar, GetDate(), 106) as '106 Conversion',
    convert(varchar, GetDate(), 107) as '107 Conversion',
    convert(varchar, GetDate(), 108) as '108 Conversion',
    convert(varchar, GetDate(), 109) as '109 Conversion',
    convert(varchar, GetDate(), 110) as '110 Conversion',
    convert(varchar, GetDate(), 111) as '111 Conversion',
    convert(varchar, GetDate(), 112) as '112 Conversion',
    convert(varchar, GetDate(), 113) as '113 Conversion',
    convert(varchar, GetDate(), 114) as '114 Conversion',
    convert(varchar, GetDate(), 120) as '120 Conversion',
    convert(varchar, GetDate(), 121) as '121 Conversion',
    convert(varchar, GetDate(), 126) as '126 Conversion',
    convert(varchar, GetDate(), 130) as '130 Conversion',
    convert(varchar, GetDate(), 131) as '132 Conversion'

Cheers,

M.
 
Think it's a general script we all have to hand for when the grey matter isn't running on optimal performance!

Cheers,

M.
 
My grey matter is now all black matter.....any data retention tends to disappear at around 11am. I have scripts to remnd me i have scripts to do things these days......:)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top