strtotime

    1熱度

    3回答

    我想在給定日期使用strttotime得到下一個monday,但我從Jan 1970獲取日期作爲輸出。下面是我爲下一個星期一的獲取日期編寫的代碼行,我從here得到了這段代碼。任何人都可以幫助我理解爲什麼會發生這種情況。提前致謝。 代碼: $date_init = date('Y m d', strtotime('next monday', strtotime('2016 06 22')));

    0熱度

    1回答

    比如我輸入一個日期,並得到該值 2016-07-07 然後傳遞值 $c = $_POST['c'] 但我試着去只是想拿到全只有一天的話。例如,生產Thu而不是Thursday有沒有辦法呢?這是我的代碼$cc = date('D', strtotime($c));

    0熱度

    1回答

    if(!empty($maintenance_options['disable'])) { $currentDate = date("Y-m-d H:i:s", strtotime(date("Y-m-d") . date("H:i:s"))); $nodate = $maintenance_options['disable'], strtotime(date("Y-m-d")

    0熱度

    1回答

    我遇到一個小問題,但我不明白。我有兩個時間框架:上午11:35和上午12:35。在PHP中,我使用strtotime函數來比較它們(以及12:35 AM> 11:35 AM),但不是。而他們的調試值之後,我看到: strtotime("11:35 AM") : 1467711300 strtotime("12:35 AM") : 1467671700 爲什麼的strotime值(上午12時3

    0熱度

    1回答

    我試圖將用戶輸入的12小時時間轉換爲24小時的php時間,所以我可以更好地對它進行排序和報告。無論輸入什麼,下面的代碼都會返回16:00。 $starttime1 = date("H:i", strtotime("$starttime")); 在這種情況下什麼被輸送到$開始時間 是G:I:S:A或4:00:00:AM 在搜索的最後一個小時它似乎是一個問題日期功能沒有得到正確的信息,所以我試圖日

    0熱度

    1回答

    我是一個php和codeigniter的新手。 我有一個函數可以用來標記騎自行車上每公里騎行的週數總和的圖表的x軸。它從今天的日期開始計算(或應該工作),從數組傳遞零週日或1,2,3等等。 我使用的PHP版本5.6.19,這是我的代碼: 在Model: public function week_start($date, $counter){ $tstring = strtotime($

    1熱度

    1回答

    我一直在使用相同的代碼爲5年以上,PHP 5.x和突然因與的strtotime和英國的日期格式問題。我寫了這個小腳本測試: <?php echo "<br /><b>PostDate: 1-7-15</b>"; $format="d-m-y"; $date="1-7-15"; $c = strtotime($date); echo "<br /><b>Unix TS: - ".$c."<

    0熱度

    2回答

    爲什麼 <?php echo date("m/d/Y" strtotime('second Wednesday June-2016')) ?> 輸出2016年6月15日,而不是2016年6月8日? 這大約是我想出來的---不是很雄辯的工作: <?php months = array(1=>'Jan',2=>'Feb',3=>'Mar',4=>'Apr',5=>'May',6=>'Ju

    0熱度

    1回答

    我使用strtotime函數爲一個小項目,它是一個非常強大的工具,但我只需要一些幫助到它的內部。 當它自動評估給定的日期時有什麼方法可以捕獲嗎? 例如,當您輸入strtotime(「2/30/2006」)時,它將返回3/2/2006的時間戳。 或者如果您在1970年之前放置任何日期,它將返回1970年1月1日的時間戳。 對於這些輸入,strtotime函數必須做些什麼來評估這些字符串,我想知道是否

    1熱度

    1回答

    如果時間戳超過20分鐘,我試圖刪除$ lockfile。 if (file_exists($lockfile) && time() - filemtime($lockfile) > strtotime("+20 minutes")) { // If lockfile is alive for more than 20 minutes, unlink it unlink($loc