INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Date and time Tips and tricks

Which date conversion method do I use? by LNBruno
Posted: 16 Mar 06

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'

Back to Microsoft SQL Server: Programming FAQ Index
Back to Microsoft SQL Server: Programming Forum

My Archive

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close