Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Formatting datetime2(3) value
Message
 
 
To
All
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Title:
Formatting datetime2(3) value
Miscellaneous
Thread ID:
01681626
Message ID:
01681626
Views:
43
Hi everybody,

I've been trying to find some help online as how to get the desired result and could not.

I want to format the datetime2(3) value this way (say, the value is '2019-08-23 13:00:00.000') and I want to format it as
'20190823_130000.000' using format function and I can not figure out how to do the very last part of correctly showing milliseconds.

Also, I want to be able to do the opposite operation, e.g. from the character value shown in the format above I want to construct the datetime2(3) value correctly. I do have code using several substring which I created, but I was thinking if there is a more efficient and simple way?

Thanks in advance.
If it's not broken, fix it until it is.


My Blog
Next
Reply
Map
View

Click here to load this message in the networking platform