I have a given time and I'd like to confirm that is AFTER the current time.

$expires_epoch = strtotime($_POST['expiry']);
if($expires_epoch < current_time('mysql')){
...do stuff...

This snippet only works if I set my server to match my local time. That is to say that it's working in UTC time. Any ideas on what to fix? I've tried many alternative to current_time.

1 Answer 1


Please use DateTime::getTimestamp() that returns unix timestamp.

If you want to format the date according to your time zone then you try this.

$datetime = new DateTime("now", new DateTimeZone('America/New York'));

echo $datetime ->format('m/d/Y, H:i:s');

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.