I tried hard but couldn't got the answer
A:
You have two options:
Convert the value to an integer relative to some point in time. For example, on Unix, time types are usually expressed as the number of seconds since the Epoch (1.1.1970). Check your libraries what they support.
Convert the values to text and store them as a
char(10)
value.
Aaron Digulla
2009-12-18 09:51:54
Unix epoch usually is 1970-01-01 00:00:00 UTC.
dalle
2009-12-18 10:02:53
And if doing the latter, which is much more readable but harder to do calculations on, can I strongly recommend using ISO-8601 (http://en.wikipedia.org/wiki/ISO_8601) or similar to avoid ambiguity when your app takes over the world. Also, be sure to convert these values (even just dates!) to UTC before storing them, since having values in different timezones in the table will be a calculation nightmare. (And yes, timezones are relevant even to just dates -- in local time, it's two different dates across the world at any given moment. [Three sometimes in edge cases around DST?? I wonder...])
T.J. Crowder
2009-12-18 10:04:42
+1
A:
I might try storing the value as int using the format yyyyMMdd
.
Eg. 20091212
This can allow you to do between searches.
astander
2009-12-18 09:55:37