Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Run this through your query processor. It formats dates and/or times like so and one of these should give you what you're looking for. It wont be hard to adapt: </p> <pre><code>Declare @d datetime select @d = getdate() select @d as OriginalDate, convert(varchar,@d,100) as ConvertedDate, 100 as FormatValue, 'mon dd yyyy hh:miAM (or PM)' as OutputFormat union all select @d,convert(varchar,@d,101),101,'mm/dd/yy' union all select @d,convert(varchar,@d,102),102,'yy.mm.dd' union all select @d,convert(varchar,@d,103),103,'dd/mm/yy' union all select @d,convert(varchar,@d,104),104,'dd.mm.yy' union all select @d,convert(varchar,@d,105),105,'dd-mm-yy' union all select @d,convert(varchar,@d,106),106,'dd mon yy' union all select @d,convert(varchar,@d,107),107,'Mon dd, yy' union all select @d,convert(varchar,@d,108),108,'hh:mm:ss' union all select @d,convert(varchar,@d,109),109,'mon dd yyyy hh:mi:ss:mmmAM (or PM)' union all select @d,convert(varchar,@d,110),110,'mm-dd-yy' union all select @d,convert(varchar,@d,111),111,'yy/mm/dd' union all select @d,convert(varchar,@d,12),12,'yymmdd' union all select @d,convert(varchar,@d,112),112,'yyyymmdd' union all select @d,convert(varchar,@d,113),113,'dd mon yyyy hh:mm:ss:mmm(24h)' union all select @d,convert(varchar,@d,114),114,'hh:mi:ss:mmm(24h)' union all select @d,convert(varchar,@d,120),120,'yyyy-mm-dd hh:mi:ss(24h)' union all select @d,convert(varchar,@d,121),121,'yyyy-mm-dd hh:mi:ss.mmm(24h)' union all select @d,convert(varchar,@d,126),126,'yyyy-mm-dd Thh:mm:ss:mmm(no spaces)' </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload