Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
my_aro
Yak Posting Veteran
50 Posts |
Posted - 2005-11-24 : 03:26:42
|
| can i set the datetime sql server engine so that it will accept datetime data with this format (mm-dd-yy)? or is it possible to change the format of datetime of my sql server engine? |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-24 : 03:43:43
|
| Dont worry how SQL Server stores Dates. Use Presentation layer to format the date to the format you want. Use Format function at Client ApplicationMadhivananFailing to plan is Planning to fail |
 |
|
|
my_aro
Yak Posting Veteran
50 Posts |
Posted - 2005-11-24 : 03:49:06
|
| its because i have a problem with my data for for my editing for it only needs the date so i usedconvert(varchar(10),a.dte_sched, 110) for display over my page and gets a 121 when i retrieve the data.. this time if i will edit the fields i must also always edit the date.. so i was thinking that it could be a good solution changing the format of the date within the sqlserver engine.. |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2005-11-24 : 03:56:38
|
| No matter whether you add or Edit dates, when sending date from Client, format it to the format yyyymmddMadhivananFailing to plan is Planning to fail |
 |
|
|
my_aro
Yak Posting Veteran
50 Posts |
Posted - 2005-11-24 : 04:20:10
|
| ah ok thanks anyway.. i was just thinking of somewhat that would make it for the user of my software to be more easier for him or her.. anyway thanks bro! |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2005-11-24 : 04:21:43
|
as madhivanan saysquote: Dont worry how SQL Server stores Dates.
and from the Book Online on datetime and smalldatetimequote: Values with the datetime data type are stored internally by Microsoft SQL Server as two 4-byte integers. The first 4 bytes store the number of days before or after the base date, January 1, 1900. The base date is the system reference date. Values for datetime earlier than January 1, 1753, are not permitted. The other 4 bytes store the time of day represented as the number of milliseconds after midnight.The smalldatetime data type stores dates and times of day with less precision than datetime. SQL Server stores smalldatetime values as two 2-byte integers. The first 2 bytes store the number of days after January 1, 1900. The other 2 bytes store the number of minutes since midnight. Dates range from January 1, 1900, through June 6, 2079, with accuracy to the minute.
The presentation of the data or how you want to format the date time, YYYY-MM-DD or MM/DD/YYYY or DD/MM/YYYY or whatever format you like should be the responsibility of the front-end application. Or if you would like to do it in the Queries than use the convert() function-----------------[KH] |
 |
|
|
my_aro
Yak Posting Veteran
50 Posts |
Posted - 2005-11-24 : 05:06:02
|
| hahaha! ok thanks |
 |
|
|
|
|
|
|
|