Getting current date/time Mac OS total seconds

jda jda at his.com
Fri Dec 21 08:24:04 CST 2007


>
>
>>  I'd like to be able to search a db for records added within the last
>>  "X days" using SQL. I've stored the date entered as total seconds
>>  (RB, Mac OS X). With Valentina SQL I can get the date/time in
>>  year/month/day/seconds. Has anyone written a formula that will
>>  convert this to Mac OS X total seconds?
>
>I think you need date diff sql-function.
>
>http://www.valentina-db.com/dokuwiki/doku.php?id=paradigma:public:en:documentation:vsql:reference:expr:functions:datetime

Thanks, Ivan, but that's for getting the difference between two dates 
stored in sql format. I need to convert an sql date to a Mac OS 
"totalseconds" date and then compare that to the "totalseconds" 
stored with each record. This would be easy to do myself in my RB 
code, but I have to do this all with SQL (I could elaborate on the 
reasons for this, but they are irrelevant).

What I need is something like this:

SQLDateTime = Current() //date and time NOW

SQLtotalSeconds = convertToSQLSeconds(SQLDateTime) //convert to seconds

MacOSTotalSeconds = convertToMacOSTotalSeconds(SQLTotalSeconds) //Mac 
OS dates start in 1904, I believe

if MacOSTotalSeconds - oneWeekInSeconds <= storedTotalSecondsWhenCreated then
     //this record was created within the last week
end if


Jon


More information about the Valentina mailing list