[Webinar] Streamline your web hosting managementRegister Today

x
?
Solved

Windows Timestamp

Posted on 2008-01-29
7
Medium Priority
?
214 Views
Last Modified: 2013-12-13
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
0
Comment
Question by:syedasimmeesaq
  • 4
  • 3
7 Comments
 
LVL 48

Expert Comment

by:hernst42
ID: 20771403
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
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20771584
lockfield is text field

Thanks
0
 
LVL 48

Expert Comment

by:hernst42
ID: 20771658
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 ?
0
Learn to develop an Android App

Want to increase your earning potential in 2018? Pad your resume with app building experience. Learn how with this hands-on course.

 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20771773
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
0
 
LVL 48

Accepted Solution

by:
hernst42 earned 2000 total points
ID: 20772035
In this case you can do the following:

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

Author Comment

by:syedasimmeesaq
ID: 20782217
this one gives me a blank page
Thanks
0
 
LVL 9

Author Comment

by:syedasimmeesaq
ID: 20782831
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

0

Featured Post

[Webinar] Kill tickets & tabs using PowerShell

Are you tired of cycling through the same browser tabs everyday to close the same repetitive tickets? In this webinar JumpCloud will show how you can leverage RESTful APIs to build your own PowerShell modules to kill tickets & tabs using the PowerShell command Invoke-RestMethod.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses four methods for overlaying images in a container on a web page
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

590 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question