sql server - best way to get iso into usa format -


trying convert date string usa format

'20150316 16:28' '3/16/2015 4:28 pm'

(note: 24hr format fine too)

http://sqlfiddle.com/#!6/9eecb/862

the predefined format "g" give date time in format:

select format(cast('20150316 16:20' datetime), 'g')  

update:

select format( cast('20150316 16:20' datetime), 'd')  + ' ' + format( cast('20150316 16:20' datetime), 'hh:mm')  

produces 3/16/2015 16:20

see these articles predefined , custom date time formats:

https://msdn.microsoft.com/en-us/library/8kb3ddd4(v=vs.110).aspx

https://msdn.microsoft.com/en-us/library/az4se3k1(v=vs.110).aspx

note these vary culture.


Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

python - NameError: name 'subprocess' is not defined -