Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Formatting datetime2(3) value
Message
 
 
À
Tous
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Titre:
Formatting datetime2(3) value
Divers
Thread ID:
01681626
Message ID:
01681626
Vues:
44
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform