Warning: Use of undefined constant ddsg_language - assumed 'ddsg_language' (this will throw an Error in a future version of PHP) in /home/ezic/ezic.info/public_html/w.ezic.info/wp-content/plugins/sitemap-generator/sitemap-generator.php on line 44
Conditions by timestamp by PHP | EZiC[イージック]コンテンツ紹介!

Conditions by timestamp by PHP

PHP:
  1. // Specifies the file path where PHP wants to check the timestamp
  2. $file_path = '/var/www/html/';
  3.  
  4. if($dir = opendir($file_path)){
  5.     while(($file = readdir($dir)) !== false){
  6.         if($file != '.' && $file != '..'){
  7.             // Get timestamp
  8.             $get_unix = filemtime($file);
  9.                
  10.             // Specify the time range(condition)
  11.             if(strtotime('2013-02-01 22:30:00') <= $get_unix && $get_unix <= strtotime('2013-02-01 22:40:00')){
  12.                 echo $file.' is 「2013/02/01 22:30:00」 ~ 「2013/02/01 22:40:00」['.date('Y/m/d H:i:s',$get_unix).']<br />';
  13.             }else{
  14.                 echo $file.'is not「2013/02/01 22:30:00」 ~ 「2013/02/01 22:40:00」['.date('Y/m/d H:i:s',$get_unix).']<br />';
  15.             }
  16.         }
  17.     }
  18. }

タイトルとURLをコピーしました