Solved

sql epoch to php time()

Posted on 2004-09-08
3
525 Views
Last Modified: 2008-02-26
Total brain fart..

What is the correct converson for sql to php time()?

This is needed,

WHERE (now()-15552000<datesubmitted)

datesubmitted is generated by time()

Thanks
0
Comment
Question by:rockmansattic
  • 2
3 Comments
 
LVL 48

Accepted Solution

by:
hernst42 earned 250 total points
ID: 12010044
If you are using mysql you can use

WHERE (now()-15552000<FROM_UNIXTIME(datesubmitted))

See http://dev.mysql.com/doc/mysql/en/Date_and_time_functions.html
0
 
LVL 10

Author Comment

by:rockmansattic
ID: 12011281
Thank you but that wont work exactly beacuse I need only the results from the past six months hence 15552000 seconds.

Although, I will look into converting it from there.

Rockman
0
 
LVL 10

Author Comment

by:rockmansattic
ID: 12011313
Thank you

just a little tweaking
to

WHERE DAYOFYEAR(now())-180 < DAYOFYEAR(FROM_UNIXTIME(datesubmitted))

Rockman
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
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 and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

685 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