Forum Discussion
vex
14 years agoContributor
Quick Update - I've removed the SQL element of the conversion, but it still doesn't work!!
Here is what I have for code - note that sSQL is a function that I wrote that handles the SQL stuff.
Arg 1: "w" or "r" for writing a value, or reading a query
Arg 2: Database connection (dba is a variable with correct constring)
Arg 3: Query to be run
Arg 4: Field we're working with
Arg 5: Value to be placed in field (only valid with "w" mode)
Here is what I have for code - note that sSQL is a function that I wrote that handles the SQL stuff.
Arg 1: "w" or "r" for writing a value, or reading a query
Arg 2: Database connection (dba is a variable with correct constring)
Arg 3: Query to be run
Arg 4: Field we're working with
Arg 5: Value to be placed in field (only valid with "w" mode)
expDate = sSQL("r", dba, "select * from users where id = '1'", "expiration_date", "") ' This returns 3/6/2012 1:27:07 AM
postExpDate = aqDateTime.AddHours(expDate, 3) ' This properly returns 3/6/2012 4:27:07 AM into postExpDate
Call sSQL("w", dba, "select * from users where id = '1'", "expiration_date", postExpDate)
' The above works, it writes 3/6/2012 4:27:07 AM into the database
Log.Message "Expiration Date: " & postExpDate
Log.Message "Expiration ETA: " & aqConvert.DateTimeToFormatStr(aqDateTime.TimeInterval(Now(), postExpDate), "%#j days, %#H hours, %#M minutes, %#S seconds")
' The above logs the following:
'
' Expiration Date: 3/6/2012 4:27:07 AM
' Expiration ETA: 364 days, 9 hours, 55 minutes, 12 seconds
'
' Which is not correct (Now() should be around 6:27pm central)