danIT Posted June 28, 2009 Posted June 28, 2009 I need to covent: Sun Jun 28 21:03:15 +0000 2009 To the equivalent unixtime stamp?
powdarrmonkey Posted June 28, 2009 Posted June 28, 2009 (edited) PHP? I'm sure I've sent you that before Edit: it's strtotime(). Edited June 28, 2009 by powdarrmonkey
Edu-IT Posted June 28, 2009 Posted June 28, 2009 Online Conversion - Unix time conversion Might help. What James has given is correct.
danIT Posted June 28, 2009 Author Posted June 28, 2009 The problem I have is that I need to insert into a table where the date is greater than the latest date stored in database: INSERT INTO backup where $thedate > $latestdate VALUES('', '$name', '$content', '$thedate'; Where the dates have been stored as: Sun Jun 28 22:03:41 +0000 2009 So INSERT INTO backup where Sun Jun 28 22:03:41 +0000 2009 > Sun Jun 28 22:00:21 +0000 2009 VALUES('', '$name', '$content', '$thedate'; But can i compare dates like this?
mossj Posted June 28, 2009 Posted June 28, 2009 (edited) Why can't you just convert both to unix, W3schools seems to say to use "mktime()" to do this http://www.w3schools.com/php/func_date_gmmktime.asp - might be useful http://www.w3schools.com/php/func_date_strtotime.asp - or for strtime Edited June 28, 2009 by mossj
powdarrmonkey Posted June 28, 2009 Posted June 28, 2009 You can't compare complex dates like that in MySQL, only dates stored as integers. You'll have to do a select from the database, use strtotime() on the retrieved date, compare it to time(), and do an insert if appropriate.
mossj Posted June 28, 2009 Posted June 28, 2009 You can't compare complex dates like that in MySQL, only dates stored as integers. You'll have to do a select from the database, use strtotime() on the retrieved date, compare it to time(), and do an insert if appropriate. It looks like to me he has already pulled them into PHP varibles.
powdarrmonkey Posted June 28, 2009 Posted June 28, 2009 So he has. In that case, just compare strtotime($thedate) and strtotime($latestdate).
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now