SQL Server Date CAST default format -


where sql server default date format uses when returning results from:

cast(lastlogin nvarchar(max)) 

i change default format. cannot use convert() because query being generated entity framework.

i getting:

jun 22 2015  4:02pm jul 19 2015 10:02pm jan 30 2016  3:45pm jan 18 2016  2:56pm feb  4 2016 12:27pm may  7 2015  9:30am etc. 

i have looked @ regional settings on server , has not been set use date format.

if interested in ef issue: c# generic .contains() method implementing sqlfunctions.stringconvert in entity framework

i change default format.

simply put: you can't.

cast(lastlogin nvarchar(max)) 

is equivalent

convert(nvarchar(max), lastlogin) 

is equivalent to

convert(nvarchar(max), lastlogin, 0) 

which is specified return following format:

mon dd yyyy hh:miam (or pm) 

(as other have noted, xy problem, , might want start question on real problem facing.)


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -