datetime de access
Posted: Tue Sep 04, 2007 10:47 pm
como se obtiene una variable del tipo datetime de una tabla de access, usando ADO?
salu2
paco
salu2
paco
www.FiveTechSoft.com
http://forums.fivetechsoft.com/
Code: Select all
PROCEDURE Main
LOCAL d1, d2, nDiff
SET CENTURY ON
SET TIME FORMAT TO "hh:mm:ss.ccc"
? DateTime() // result: [today] [systemtime]
? {ˆ 2007/04/26} // result: 04/26/2007
? {ˆ 05:30:12.345} // result: 12/30/1999 05:30:12.345
? {ˆ 05:30:12.345 PM} // result: 12/30/1999 17:30:12.345
** Empty value
? d1 := {ˆ 0/0/0 } // result: / /
? Empty( d ) // result: .T.
** difference between DateTime and Date
? d1 := {ˆ 2007/04/26 18:30:00 } // result: 04/26/2007 18:30:00.000
? d2 := StoD("20070426") // result: 04/26/2007
? nDiff := d1-d2, "days" // result: 0.77 days
? TString( nDiff*86400 ) // result: 18:30:00
** Adding 2 days to DateTime
? d1 + 2 // result: 04/28/2007 18:30:00.000
** Adding 2 hours to DateTime
? d1 + 2/24 // result: 04/26/2007 20:30:00.000
** Adding 2 minutes to DateTime
? d1 + 2/(24*60) // result: 04/26/2007 18:32:00.000
** Adding 2 seconds to DateTime
? d1 + 2/(24*3600) // result: 04/26/2007 18:30:02.000
RETURN