Class CFW_Util_Date

Description

日付関係ユーティリティ

  • author: okada

Located in /Util/Date.php (line 16)


	
			
Variable Summary
static integer $DaysToSuggestYear
static bool $UseUpperCase
static integer $weekDayBase
static integer $yearsForAgeByMonth
Method Summary
static object 加算結果 addDate (object $date, integer $diff, string $unit)
static object 加算後の日付 addDays (object $d, integer $days)
static object 加算後の日付 addMonths (object $d, integer $months)
static object 加算後の日付 addYears (object $d, integer $years)
static integer ageMonth (object $birthday, object $baseDate)
static string ageString (object $birthday, object $baseDate)
static string ageStringJP (object $birthday, object $baseDate)
static integer ageYear (object $birthday, object $baseDate)
static 指定年月日から成る日付 create (integer $y, integer $m, integer $d)
static object 指定月日でかつ基準日以降の日付 createFromMonthDay (integer $m, integer $d)
static 指定年月+1日の日付 createFromYearMonth (integer $y, integer $m)
static object 年推論の基準にする日付 dateToSuggestYear ()
static void day ( $date)
static void dayOfWeek ( $date)
static integer dayOfWeekIndex (object $object)
static string dayOfWeekString (object $object)
static string dayOfWeekStringJP (object $object)
static $intDiff diffDays (object $d1, object $d2)
static object 指定日付の月の月末 endOfMonth (object $d)
static object 指定年月のafterヶ月後の月末 endOfMonthAfter (integer $year, integer $month, integer $after)
static object 指定年月の月末 endOfYearMonth (integer $year, integer $month)
static string format (datetime $date, [string $formatString = CFW_Constants_DateTime::FORMAT_DATE_TIME])
static void hour ( $date)
static object 年推論の基準にする日付以降でもっとも現在に近い日付 inferYear (object $d)
static boolean isAfter (object $d1, object $d2)
static boolean isAfterOrSame (object $d1, object $d2)
static boolean isBefore (object $d1, object $d2)
static boolean isBeforeOrSame (object $d1, object $d2)
static boolean isEndOfMonth (object $d)
static boolean isInRange (object $object, object $min, object $max)
static boolean isSame (object $d1, object $d2)
static void minute ( $date)
static void month ( $date)
static object 指定年月のafterヶ月後の月初 monthAfter (integer $year, integer $month, integer $after)
static object 指定年月の翌月の1日 nextMonth (integer $year, integer $month)
static 現在(時刻を含む) now ()
static object 解析結果の日付。解析エラーの場合null parse (string $s)
static object 指定年月の昨月の1日 previousMonth (integer $year, integer $month)
static void second ( $date)
static Date toDate ($value $value)
static 今日(時刻を含まない= today ()
static 指定日付の0時0分を表す日付 truncateTime (object $object)
static void year ( $date)
Variables
static integer $DaysToSuggestYear = -3 (line 40)

年を示唆するための日数

  • access: public
static bool $UseUpperCase = true (line 34)

US月表示を大文字にする

  • access: public
static integer $weekDayBase = 0 (line 28)

曜日インデックスの開始

  • access: public
static integer $yearsForAgeByMonth = 2 (line 22)

年齢を月表示にするための年数

  • access: public
Methods
static method addDate (line 482)

日付計算

  • access: public
static object 加算結果 addDate (object $date, integer $diff, string $unit)
  • object $date: 計算の基準日
  • integer $diff: 加算する日数、月数、年数
  • string $unit: 単位をあらわす文字 y,m,d
static method addDays (line 563)

日数加算

  • access: public
static object 加算後の日付 addDays (object $d, integer $days)
  • object $d: 日付
  • integer $days: 加算日数
static method addMonths (line 575)

月数加算

  • access: public
static object 加算後の日付 addMonths (object $d, integer $months)
  • object $d: 日付
  • integer $months: 加算月数
static method addYears (line 587)

年加算

  • access: public
static object 加算後の日付 addYears (object $d, integer $years)
  • object $d: 日付
  • integer $years: 加算年数
static method ageMonth (line 219)

年齢(月)

  • return: 年齢(月単位)
  • access: public
static integer ageMonth (object $birthday, object $baseDate)
  • object $birthday: 誕生日
  • object $baseDate: 基準日
static method ageString (line 234)

基準日と生年月日から99Y(24ヶ月以上)または99M(24ヶ月未満)の文字列を得る

  • access: public
static string ageString (object $birthday, object $baseDate)
  • object $birthday: 誕生日
  • object $baseDate: 基準日
static method ageStringJP (line 251)

基準日と生年月日から99歳または99ヶ月(24ヶ月未満)の文字列を得る

  • access: public
static string ageStringJP (object $birthday, object $baseDate)
  • object $birthday: 誕生日
  • object $baseDate: 基準日
static method ageYear (line 202)

年齢

  • return: 年齢
  • access: public
static integer ageYear (object $birthday, object $baseDate)
  • object $birthday: 誕生日
  • object $baseDate: 基準日
static method create (line 128)

年、月、日の要素から日付生成

  • access: public
static 指定年月日から成る日付 create (integer $y, integer $m, integer $d)
  • integer $y: 年をあらわす数値
  • integer $m: 月をあらわす数値
  • integer $d: 日をあらわす数値
static method createFromMonthDay (line 154)

月日の要素から日付生成

年は基準日以降の最初の年を仮定

  • access: public
static object 指定月日でかつ基準日以降の日付 createFromMonthDay (integer $m, integer $d)
  • integer $m: 月をあらわす数値
  • integer $d: 日をあらわす数値
static method createFromYearMonth (line 142)

年、月の要素から日付生成

日は1日を仮定

  • access: public
static 指定年月+1日の日付 createFromYearMonth (integer $y, integer $m)
  • integer $y: 年をあらわす数値
  • integer $m: 月をあらわす数値
static method dateToSuggestYear (line 92)

年推論の基準にする日付

  • access: public
static object 年推論の基準にする日付 dateToSuggestYear ()
static method day (line 618)
  • access: public
static void day ( $date)
  • $date
static method dayOfWeek (line 630)
  • access: public
static void dayOfWeek ( $date)
  • $date
static method dayOfWeekIndex (line 268)

曜日のインデックス(weekDayBaseから始まる).

曜日の基準(weekDayBase)により1-7または0-6

  • return: 曜日のインデックス.曜日の基準(weekDayBase)により1-7または0-6
  • access: public
static integer dayOfWeekIndex (object $object)
  • object $object: 指定日付
static method dayOfWeekString (line 281)

曜日文字列

  • return: 指定日付の曜日
  • access: public
static string dayOfWeekString (object $object)
  • object $object: 指定日付
static method dayOfWeekStringJP (line 293)

曜日文字列

  • return: 指定日付の曜日
  • access: public
static string dayOfWeekStringJP (object $object)
  • object $object: 指定日付
static method diffDays (line 181)

日数計算

  • return: 基準日から比較対象日までの日数
  • access: public
static $intDiff diffDays (object $d1, object $d2)
  • object $d1: 基準日
  • object $d2: 比較対象日
static method endOfMonth (line 528)

指定日付の月の月末

  • access: public
static object 指定日付の月の月末 endOfMonth (object $d)
  • object $d: 指定日付
static method endOfMonthAfter (line 520)

何ヶ月か後の月末

  • access: public
static object 指定年月のafterヶ月後の月末 endOfMonthAfter (integer $year, integer $month, integer $after)
  • integer $year: 年
  • integer $month: 月
  • integer $after: 加算する月数
static method endOfYearMonth (line 540)

指定月の月末

  • access: public
static object 指定年月の月末 endOfYearMonth (integer $year, integer $month)
  • integer $year: 指定年
  • integer $month: 指定月
static method format (line 114)

Date型をString型にして出力

  • return: 変換したString型
  • access: public
static string format (datetime $date, [string $formatString = CFW_Constants_DateTime::FORMAT_DATE_TIME])
  • datetime $date: 変換対象DateTime型
  • string $formatString: フォーマット方式
static method hour (line 621)
  • access: public
static void hour ( $date)
  • $date
static method inferYear (line 100)

年推論

  • access: public
static object 年推論の基準にする日付以降でもっとも現在に近い日付 inferYear (object $d)
  • object $d
static method isAfter (line 372)

指定日より後か

  • return: 対象日が基準日より後ならtrue
  • access: public
static boolean isAfter (object $d1, object $d2)
  • object $d1: 対象日
  • object $d2: 基準日
static method isAfterOrSame (line 390)

指定日より後か同じか

  • return: 対象日が基準日より後か同じならtrue
  • access: public
static boolean isAfterOrSame (object $d1, object $d2)
  • object $d1: 対象日
  • object $d2: 基準日
static method isBefore (line 335)

指定日より前か

  • return: 対象日が基準日より前ならtrue
  • access: public
static boolean isBefore (object $d1, object $d2)
  • object $d1: 対象日
  • object $d2: 基準日
static method isBeforeOrSame (line 353)

指定日より前か同じか

  • return: 対象日が基準日より前か同じならtrue
  • access: public
static boolean isBeforeOrSame (object $d1, object $d2)
  • object $d1: 対象日
  • object $d2: 基準日
static method isEndOfMonth (line 550)

月末チェック

  • return: 月末ならtrue
  • access: public
static boolean isEndOfMonth (object $d)
  • object $d: 指定日付
static method isInRange (line 309)

範囲の正当性を検証

  • return: 範囲が正当ならばtrue,でなければfalse
  • access: public
static boolean isInRange (object $object, object $min, object $max)
  • object $object: 検証する対象
  • object $min: 範囲(最小値)
  • object $max: 範囲(最大値)
static method isSame (line 409)

指定日と同じか

  • return: 対象日が基準日と同じならtrue
  • access: public
static boolean isSame (object $d1, object $d2)
  • object $d1: 対象日
  • object $d2: 基準日
static method minute (line 624)
  • access: public
static void minute ( $date)
  • $date
static method month (line 615)
  • access: public
static void month ( $date)
  • $date
static method monthAfter (line 505)

何ヶ月か後

  • access: public
static object 指定年月のafterヶ月後の月初 monthAfter (integer $year, integer $month, integer $after)
  • integer $year: 年
  • integer $month: 月
  • integer $after: 加算する月数
static method nextMonth (line 600)

次の月

  • access: public
static object 指定年月の翌月の1日 nextMonth (integer $year, integer $month)
  • integer $year: 年
  • integer $month: 月
static method now (line 83)

現在(時刻を含む)

  • access: public
static 現在(時刻を含む) now ()
static method parse (line 427)

文字列を解析して日付型に変換

  • access: public
static object 解析結果の日付。解析エラーの場合null parse (string $s)
  • string $s: 日付形式の文字列
static method previousMonth (line 609)

前の月

  • access: public
static object 指定年月の昨月の1日 previousMonth (integer $year, integer $month)
  • integer $year: 年
  • integer $month: 月
static method second (line 627)
  • access: public
static void second ( $date)
  • $date
static method toDate (line 47)

Dateが期待される値をDateTimeに

  • return: 変換した日付
  • access: public
static Date toDate ($value $value)
  • $value $value: 変換する対象の文字列型の式
static method today (line 72)

今日(時刻を含まない= 0時0分)

  • return: 0時0分)
  • access: public
static 今日(時刻を含まない= today ()
static method truncateTime (line 170)

時刻を捨てる

  • access: public
static 指定日付の0時0分を表す日付 truncateTime (object $object)
  • object $object
static method year (line 612)
  • access: public
static void year ( $date)
  • $date

Documentation generated on Fri, 25 Dec 2009 22:44:58 +0900 by phpDocumentor 1.4.3