question

Allenb avatar image
Allenb asked

Date conversion to military time

Hello, I need to convert date YYYY-MM-DD HH:MM:SS.000 to DD-MMM-YYYY HH:MM:SS Example: 2016-12-20 15:01:55.697 ==> 20-Dec-2016 15:01:55 -- Keep this as a military time 2016-12-21 09:55:41.993 ==> 21-Dec-2016 09:55:41 Thanks for your help.
sql-server-2012
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
David Wimbush avatar image
David Wimbush answered
You can use the format function: select format(getdate(), 'dd-MMM-yyyy HH:mm:ss');
1 comment
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Allenb avatar image Allenb commented ·
Hi Davis, Thanks for your query. It works great.
0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.