[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 572
  • Last Modified:

sql epoch to php time()

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
rockmansattic
Asked:
rockmansattic
  • 2
1 Solution
 
hernst42Commented:
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
 
rockmansatticAuthor Commented:
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
 
rockmansatticAuthor Commented:
Thank you

just a little tweaking
to

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

Rockman
0

Featured Post

Technology Partners: 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!

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now