PHP の時刻と日付の処理と並べ替え
WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
リリース: 2016-07-25 08:43:48
- //期間内のすべての月のタイムスタンプを返します
-
- function monthList($start,$end){
- if(!is_numeric($start)||!is_numeric($end)||($end< ;=$start)) return '';
- $start=date('Y-m',$start);
- $end=date('Y-m',$end);
- //タイムスタンプに変換します
- $ start=strtotime($start.'-01');
- $end=strtotime($end.'-01');
- $i=0;
- $d=array();
- while($start //各月に蓄積される合計秒数の計算式は、前月 1 日のタイムスタンプの秒数から当月のタイムスタンプの秒数を引いたものです
- $d[$i]=trim(date ('Y-m',$start),' ');
- $start+=strtotime('+1 month',$start)-$start;
- $i++;
- }
- return $d;
-
- }
-
- //日付型を渡すことで、期間内の週の開始日と終了日を返します
-
- function monthList($start,$end){
- if(!is_numeric($start)||!is_numeric($end)|| ($end< ;=$start)) return '';
- $start=date('Y-m',$start);
- $end=date('Y-m',$end);
- //に変換タイムスタンプ
- $start=strtotime($start.'-01');
- $end=strtotime($end.'-01');
- $i=0;
- $d=array();
- while($start< ;= $end){
- //各月に蓄積される合計秒数の計算式は、前月 1 日のタイムスタンプ秒から当月のタイムスタンプ秒を引いたものです
- $d[$i]=トリム(日付 ('Y-m',$start),' ');
- $start+=strtotime('+1 month',$start)-$start;
- $i++;
- }
- return $d;
- }
-
- / /月の最初と最後の日を返します
-
- function getthemonth($date)
- {
- $firstday = date('Y-m-01', strtotime($date));
- $lastday = date('Y-m-d) ', strtotime("$firstday +1 month -1 day"));
- return array($firstday,$lastday)
- $today = date("Y-m-d"); ;
-
-
コードをコピー
|
PHP
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
著者別の最新記事
-
2025-02-26 03:58:14
-
2025-02-26 03:38:10
-
2025-02-26 03:17:10
-
2025-02-26 02:49:09
-
2025-02-26 01:08:13
-
2025-02-26 00:46:10
-
2025-02-25 23:42:08
-
2025-02-25 22:50:13
-
2025-02-25 21:54:11
-
2025-02-25 20:45:11