|
 |
asp_web_howto thread: Inserting Time() into SQL Database
Message #1 by "Ken Lee" <tormented1_au@h...> on Tue, 17 Sep 2002 17:16:25 +1000
|
|
Hi All,
I'm having a little bit of a problem inserting time into a SQL database. Everytime I tried to insert just Time() or
FormatDateTime(Time(), 3), it just keep appearing as 1/1/1900 3:30 pm.....
Can anyone help?
Thanks in advance!
KenMSN Photos is the easiest way to share and print your photos: Click Here
Message #2 by Keith Bamberger <keith@p...> on 17 Sep 2002 09:28:59 +0200
|
|
Is this a row that you want to see when inserted or updated? if it is
inserted only you can set a default value in that field as the time so
that you dont need to pass it in, it will be there whenever you insert
into that row!
Ken Lee <tormented1_au@h...> skrev (9/17/2002):
>Hi All,
>=A0 I'm having a little bit of a problem inserting time into a SQL
>database. Everytime I tried to insert just Time() or FormatDateTime(Time()
,
>3), it just keep appearing as 1/1/1900 3:30 pm.....
>=A0 Can anyone help?
>=A0 Thanks in advance!
>KenMSN Photos is the easiest way to share and print your photos:
>Click Here
>
>
>---
>
>Improve your web design skills with these new books from Glasshaus.
>
>Usable Web Menus
>http://www.amazon.com/exec/obidos/ASIN/1904151027/ref=3Dnosim/
theprogramme
>r-20
>Constructing Accessible Web Sites
>http://www.amazon.com/exec/obidos/ASIN/1904151000/ref=3Dnosim/
theprogramme
>r-20
>Practical JavaScript for the Usable Web
>http://www.amazon.com/exec/obidos/ASIN/1904151051/ref=3Dnosim/
theprogramme
>r-20
>to unsubscribe send a blank email to leave-asp_web_howto-1310387Q@p...
wrox.com.
>
>
Message #3 by "phil griffiths" <pgtips@m...> on Tue, 17 Sep 2002 09:15:13
|
|
Is the db SQL Server? If so, there is no data type for time values only,
just datetime. So if you just add the time, you get the default date
too. Same goes if you try to just add the date, you get default time
(midnight) too.
hth
Phil
>------------------------------------------
> Hi All,
I'm having a little bit of a problem inserting time into a SQL database.
Everytime I tried to insert just Time() or FormatDateTime(Time(), 3), it
just keep appearing as 1/1/1900 3:30 pm.....
Can anyone help?
Thanks in advance!
KenMSN Photos is the easiest way to share and print your photos: Click Here
Message #4 by "Tom Zhang" <tzhang@p...> on Fri, 20 Sep 2002 13:47:14
|
|
You may ues getdate() function:
insert into mytable (timefieldname)
values(getdate())
if you execute this through an asp page, now() function and single quotes
may be used:
sql="insert into mytalbe(timefieldname) values ('" & now() & "')"
Tom
> Hi All,
I'm having a little bit of a problem inserting time into a SQL database.
Everytime I tried to insert just Time() or FormatDateTime(Time(), 3), it
just keep appearing as 1/1/1900 3:30 pm.....
Can anyone help?
Thanks in advance!
KenMSN Photos is the easiest way to share and print your photos: Click Here
|
|
 |