We help IT Professionals succeed at work.

Windows Timestamp

syedasimmeesaq
on
Hi experts

I am trying to do some time calculations and I am using windows server 2003. I tried using the following statement below but it didn't work as it asks for unix timestamp, how can I change it to work with windows timestamp

UPDATE MyTable SET LockField=0 WHERE LockField<time(CURTIME())-3600;

Thanks
Comment
Watch Question

Top Expert 2007

Commented:
Which type is the field  LockField in the database?

There are also functions to use unix-timstamp in the database: http://dev.mysql.com/doc/refman/5.0/en/date-and-time-functions.html#function_unix-timestamp

Author

Commented:
lockfield is text field

Thanks
Top Expert 2007

Commented:
Can you prive information how the content of the column lockField look like e.g 2007-01-01 1:1:1 or something like 1223432432 ?

Author

Commented:
hernst42 thanks for your reply. The contents are in this format
2008-01-29 14:17:27

so this has the year, month and date and then time is 2;17 pm which is represented by I guess military time, which is ok.
Hope that helps
thanks
Top Expert 2007
Commented:
In this case you can do the following:

UPDATE MyTable SET LockField=0 WHERE LockField < NOW() - INTERVAL 1 HOUR

Author

Commented:
this one gives me a blank page
Thanks

Author

Commented:
did this
UPDATE MyTable SET LockField=0 WHERE LockField < NOW() - 300;
but when I run the query, it sets up the field to 0 right away even if it had been only 5 second.

It is suppose to wait for 10 minutes time as the lock field has this value
date('Y-m-d H:i:s', gmmktime()) in this form 2008-01-30 16:43:49

Explore More ContentExplore courses, solutions, and other research materials related to this topic.