Solved

sql epoch to php time()

Posted on 2004-09-08
3
531 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Don't Cry: How Liquid Web is Ensuring Security

WannaCry is just the start. Read how Liquid Web is protecting itself and its customers against new threats.

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…
Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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…

690 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