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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Which date conversion method do I use?

Date and time Tips and tricks

Which date conversion method do I use?

by  LNBruno  Posted    (Edited  )
I can never remember which data conversion method returns what, so I've got this little T-SQL statement stashed and just run it whenever the question comes up.

Code:
--date conversion methods:
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 '131 Conversion'
Register to rate this FAQ  : BAD 1 2 3 4 5 6 7 8 9 10 GOOD
Please Note: 1 is Bad, 10 is Good :-)

Part and Inventory Search

Back
Top