TSQL Convert DateTime

/ Published in: SQL
Save to your folder(s)

I am forever forgetting this. Have to look up the 101 vs 103 in books online every time.
Also forget which way around is US/NZ format. :-)

Copy this code and paste it in your HTML
  1. --UK/NZ format dd/mm/yyyy
  2. SELECT CONVERT(DATETIME, '21/03/2000', 103)
  4. --US format mm/dd/yyyy
  5. SELECT CONVERT(DATETIME, '03/21/2000', 101)

Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.