datetime problem
-
Hi, am developing application in .net,c#. am saving datetime value as: yyyy-MM-ss HH:mm:ss (24 hour format) after saving in database i observed in database , it's stored in specified format . and here the problem is: when i retrieve data , datetime is coming as 12 hour format. what to do........
-
Hi, am developing application in .net,c#. am saving datetime value as: yyyy-MM-ss HH:mm:ss (24 hour format) after saving in database i observed in database , it's stored in specified format . and here the problem is: when i retrieve data , datetime is coming as 12 hour format. what to do........
When you store date/time AS date/time in database you store some binary (like milliseconds since 1st of January 1970). Database do nothing and care less about the representation of that date/time. You have to look into the code to see where the problem (you may have locals with 12 hours). If you store date/time as string - you do a big mistake!!!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
When you store date/time AS date/time in database you store some binary (like milliseconds since 1st of January 1970). Database do nothing and care less about the representation of that date/time. You have to look into the code to see where the problem (you may have locals with 12 hours). If you store date/time as string - you do a big mistake!!!
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
it's ok, but how to add milliseconds. actually, in c# am using DateTimePicker control.this will give only (year-month-date hour:minutes:seconds) it doesn't support milliseconds. so , Is there any way to get the data stored in database as it is.(24 hour format)
-
it's ok, but how to add milliseconds. actually, in c# am using DateTimePicker control.this will give only (year-month-date hour:minutes:seconds) it doesn't support milliseconds. so , Is there any way to get the data stored in database as it is.(24 hour format)
You didn't read or didn't understand what I've told - database do not store date/time in any format but binary!!! For proper formatting in your DateTimePicker go to the help of that specific control...
I'm not questioning your powers of observation; I'm merely remarking upon the paradox of asking a masked man who he is. (V)
-
it's ok, but how to add milliseconds. actually, in c# am using DateTimePicker control.this will give only (year-month-date hour:minutes:seconds) it doesn't support milliseconds. so , Is there any way to get the data stored in database as it is.(24 hour format)
You store DateTimePicker.Value, not DateTimePicker.Value.ToString() or DateTimePicker.Text. Also make sure that you set the display format of the DateTimePicker to the format you want to see.
-
Hi, am developing application in .net,c#. am saving datetime value as: yyyy-MM-ss HH:mm:ss (24 hour format) after saving in database i observed in database , it's stored in specified format . and here the problem is: when i retrieve data , datetime is coming as 12 hour format. what to do........
-
Hi, am developing application in .net,c#. am saving datetime value as: yyyy-MM-ss HH:mm:ss (24 hour format) after saving in database i observed in database , it's stored in specified format . and here the problem is: when i retrieve data , datetime is coming as 12 hour format. what to do........
Databases save datetime values as numbers. There is no datetime format in which the computer system stores a datetime. Once you understand this you can then understand that the format of the datetime data returned to you will be dependent on the collation of your database, when you perform a simple select,or the format you extract the data as. All you need to remember is that the datetime value is saved, within the database, as a number and you will then understand that all formatting issues are resolvable. N.B. for this reason never save a datetime as a string as if you do you will lose precision.
“That which can be asserted without evidence, can be dismissed without evidence.”
― Christopher Hitchens