i have a datetime field that i'm just storing the date like 5/17/2005.
i need to add the time like 10:30 PM to it. Should I store the time in
another field and concatenate? Right now, i just have a calendar date picker
on user form and will add time drop down fields to handle time.
any suggestions?I would recommend storing both the Date and Time in the one column since
combined they represent a single instance in time. Let the GUI, business or
data
layers combine the data into a single DateTime value.
Thomas
"scott" <sbailey@.mileslumber.com> wrote in message
news:e4%23rIu$WFHA.2448@.TK2MSFTNGP12.phx.gbl...
>i have a datetime field that i'm just storing the date like 5/17/2005.
> i need to add the time like 10:30 PM to it. Should I store the time in ano
ther
> field and concatenate? Right now, i just have a calendar date picker on us
er
> form and will add time drop down fields to handle time.
> any suggestions?
>|||>> i have a datetime field [sic] that i'm just storing the date like
5/17/2005.<<
No, you are not. If it were a field, then you can put anything into
it, but a column (which is nothing like a field) has a data type, and
the DATETIME data type includes year, month, day, hour, minute, second
and fractional second.
Also, that string you showed has nothing whatsoevdr to do with the
storage of temporal data. That is display and display is a task for
the front end, not the database. You might also want to start using
ISO-8601 temporal formats instead of "local dialect" -- this Internet
thing might catch on, you might need to exchange data, avoid errors,
etc.|||> You might also want to start using
> ISO-8601 temporal formats instead of "local dialect"
That is interesting! Joe suggests using non-ANSI SQL compliant elements. IS
O 8601 is
'2004-05-23T14:12:23', and this format is not supported in ANSI SQL. In ANSI
SQL, you need to
replace the T with a blank, but that makes it language and datetime dependen
t in SQL Server.
Scott, for datetime format recommendations, I suggest you check out:
http://www.karaszi.com/SQLServer/info_datetime.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"--CELKO--" <jcelko212@.earthlink.net> wrote in message
news:1116457963.195486.21040@.g44g2000cwa.googlegroups.com...
> 5/17/2005.<<
> No, you are not. If it were a field, then you can put anything into
> it, but a column (which is nothing like a field) has a data type, and
> the DATETIME data type includes year, month, day, hour, minute, second
> and fractional second.
> Also, that string you showed has nothing whatsoevdr to do with the
> storage of temporal data. That is display and display is a task for
> the front end, not the database. You might also want to start using
> ISO-8601 temporal formats instead of "local dialect" -- this Internet
> thing might catch on, you might need to exchange data, avoid errors,
> etc.
>
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment