Click here to Skip to main content
15,892,005 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do you create a DateTime in a specific format in SQL Server
Posted
Updated 11-Dec-11 15:26pm
v3

A DateTime does not have a format: it is stored as a a number of microseconds since an arbitrary point in time.
You can use the SQL FORMAT function[^] to do it, but I don't recommend it - it is much better to return a DateTime value and then format it for display at the last moment. If you format it in SQL, then you are fixing the format to one which may not be what the user is used to: if he normally gets US format, then European is not helpful. If he expects European and gets Japanese, it is also a pain.
 
Share this answer
 
Comments
Monjurul Habib 11-Dec-11 21:26pm    
5!
thank you
I want to store date only without time
in the form I am use the fromat date in the code but the store date and time
can you help
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900