mercredi 14 janvier 2015

How can i select a datetime as ddMMyy, so a two-digit year?

I'm replacing my C# code for performance reasons with a sql query:



CreatedAt.ToString("ddMMyy", System.Globalization.CultureInfo.InvariantCulture)


returns the creation-date as 140114(for today). Simple enough in C#, but how do i get this in T-SQL?


I have tried:



REPLACE(CONVERT(CHAR(10), ChargeArrival.CreatedAt, 103), '/', '')


which is almost correctly, but the year has four digits instead of two, so 14012014 instead of 140114.


Aucun commentaire:

Enregistrer un commentaire