Jump to content

using strtotime() ???


knowram

Recommended Posts

You would want to use strtotime() with the date() function to get out the hours in 24 hour time and use that number for your comparison:

<?php
$time = 'Apr 30 2007 7:00AM';
$hour = date('g',strtotime($time));
if ($hour >= 7 && $hour <= 19)
     echo $time . ' is between 7 AM and 7 PM<br>';

if (date('l',strtotime($time)) .eqs. "Sunday") echo $time . ' is a Sunday'; // the argument to date() is a small L
?>

 

Ken

Link to comment
https://forums.phpfreaks.com/topic/52870-using-strtotime/#findComment-261046
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.