artpang
|
| Posted: 11/27/2002, 5:47 PM |
|
HI everyone. I'm brand new to this site but I had a question on how to handle Dates and Times in SQL
Example:
dim SomeTime, SomeDate
INSERT INTO Calender (theTime, theDate) VALUES (?????SomeTime??????SomeDate??????)
Please Help. I've never handled dates and times before since i'm new
Art
|
|
|
 |
Ed Yin
|
| Posted: 11/30/2002, 8:42 AM |
|
fieldname = "Date"
click field properties
insert fieldname "Date"
Default Value: =date("Y-m-j",mktime(0,0,0,date("m")(+3),date("d"),date("Y")))
the (+3) is example 3 months from now.
try this....want to see the sql enter the *.php file and examine it:)
good luck
|
|
|
 |
dwelsh
|
| Posted: 11/30/2002, 9:15 AM |
|
Heres just another quick example for you too.
This is just a fast writeup, I think this would for you too.
There a a number of different ways to handle this issue.
-----------------------------------------------
Dim cnt
Dim rs
Dim sql
Dim theTime
Dim theDate
theDate = CCFormatDate(now, Array("mm", "/", "dd", "/", "yy"))
theTime = CCFormatDate(now, Array("h", ":", "nn", " ", "AM/PM"))
Set cnt = Server.CreateObject("ADODB.Connection")
Set rs = Server.CreateObject("ADODB.Recordset")
strCnn = "Provider=MSDASQL;" & _
"Data Source=someDNS;User Id=username;Password=password; "
cnt.Open strCnn
sql = "INSERT INTO Web_Direct_PO_Receivings (" & _
"theDate" & ", " & _
"theTime" & _
") VALUES (" & _
"'" & theDate & "', " & _
"'" & theTime & "', " & _
")"
'Optional parameters rem out
rs.Open sql , cnt ', adOpenKeyset, adLockOptimistic
set rs=nothing
cnt.Close
Set cnt = Nothing
----------------------------------
|
|
|
 |
dwelsh
|
| Posted: 11/30/2002, 9:18 AM |
|
DOH!
some of my dims dont match my variables. Sorry about that.
But you see whats its up to.
|
|
|
 |
|