Page 1 of 1

Comparing postgresql dates

Posted: Fri Apr 19, 2013 6:42 pm
by barb woolums
I have a signup date in a postgresql database in the format yyyy-mm-dd

In php I want to determine if this date is greater than a certain date. How do I do this?

I tried the code below but it obviously doesn't work as they are strings

Code: Select all

if ($signup > '2013-02-23') {
	code...
}

Re: Comparing postgresql dates

Posted: Sat Apr 20, 2013 2:46 am
by Benjamin
You can convert it to a Unix Timestamp using strtotime() http://us2.php.net/manual/en/function.strtotime.php