phpDocumentor utility
[ class tree: utility ] [ index: utility ] [ all elements ]

Class: WindDate

Source Location: /utility/WindDate.php

Class WindDate

Class Overview

日期的换算与计算

Located in /utility/WindDate.php [line 11]



		
				Author(s):
		
		
		
Information Tags:
Version:  $Id: WindDate.php 2973 2011-10-15 19:22:48Z yishuo $
Copyright:  ©2003-2103 phpwind.com
License:  http://www.windframework.com

Methods

[ Top ]
Method Summary
static string   dateAdd()   返回向指定日期追加指定间隔类型的一段时间间隔后的日期
static string   dateDiff()   获取两个日期的差
static string   datePart()   获取日期的某部分
static string   format()   格式化输出
static string   getChinaDate()   取得中国日期时间
static string   getChinaWeek()   取得中国的星期
static int   getDaysInMonth()   获取该月的天数
static int   getDaysInYear()   获取该年的天数
static array   getLastDate()   比较两个时间返回离现在最近的一个时间
static int   getMicroTime()   获取微秒数
static string   getPeriodOfTime()   取得一天中的时段
static array   getRealDaysInMonthsOfYear()   得到一年中每个月真实的天数
static string   getRFCDate()   取得RFC格式的日期与时间
static int   getTimeStamp()   获得时间戳
static string   getTimeZone()   获取时区
static string   getUTCDate()   获取UTC日期格式
static boolean   isLeapYear()   判断是否是闰年
static void   setTimezone()   设置时区

[ Top ]
Methods
static method dateAdd  [line 100]

  static string dateAdd( string $interval, int $value, string $dateTime, [mixed $format = null]  )

返回向指定日期追加指定间隔类型的一段时间间隔后的日期

Parameters:
string   $interval:  字符串表达式,是所要加上去的时间间隔类型。
int   $value:  数值表达式,是要加上的时间间隔的数目。其数值可以为正数(得到未来的日期),也可以为负数(得到过去的日期)。
string   $dateTime:  表示日期的文字,这一日期还加上了时间间隔。
mixed   $format:  格式化输出

API Tags:
Return:  返回追加后的时间
Access:  public


[ Top ]
static method dateDiff  [line 61]

  static string dateDiff( string $interval, mixed $startDateTime, mixed $endDateTime  )

获取两个日期的差

Parameters:
string   $interval:  返回两个日期差的间隔类型
mixed   $startDateTime:  开始日期
mixed   $endDateTime:  结束日期

API Tags:
Access:  public


[ Top ]
static method datePart  [line 49]

  static string datePart( string $interval, [mixed $dateTime = null]  )

获取日期的某部分

Parameters:
string   $interval:  字符串表达式 ,时间间隔类型
mixed   $dateTime:  表示日期的文字,默认为null则用当前时间

API Tags:
Return:  返回日期的某部分
Access:  public


[ Top ]
static method format  [line 38]

  static string format( [string $format = null], [int $dateTime = null]  )

格式化输出

Parameters:
string   $format:  目标格式,默认为null则以Y-m-d H:i:s格式输出
int   $dateTime:  unix时间戳,默认为null则用当前时间

API Tags:
Access:  public


[ Top ]
static method getChinaDate  [line 193]

  static string getChinaDate( [int $time = null]  )

取得中国日期时间

Parameters:
int   $time:  需要使用的时间戳,默认为null则获取当前时间戳

API Tags:
Access:  public


[ Top ]
static method getChinaWeek  [line 204]

  static string getChinaWeek( [int $week = null]  )

取得中国的星期

Parameters:
int   $week:  处国人的星期,是一个数值,默认为null则使用当前时间

API Tags:
Access:  public


[ Top ]
static method getDaysInMonth  [line 153]

  static int getDaysInMonth( int $month, int $year  )

获取该月的天数

Parameters:
int   $month:  月份
int   $year:  年份

API Tags:
Access:  public


[ Top ]
static method getDaysInYear  [line 168]

  static int getDaysInYear( $year  )

获取该年的天数

Parameters:
   $year: 

API Tags:
Access:  public


[ Top ]
static method getLastDate  [line 299]

  static array getLastDate( int $time, [int $timestamp = null], [string $format = null], [array $type = 1]  )

比较两个时间返回离现在最近的一个时间

Parameters:
int   $time:  当前时间戳
int   $timestamp:  比较的时间戳,默认为null则获取当前时间戳
string   $format:  格式化当前时间戳,默认为null则转化为格式Y-m-d H:i:s
array   $type:  要返回的时间类型,默认为 1则只返回Y-m-d否则返回Y-m-d m-d H:i

API Tags:
Access:  public


[ Top ]
static method getMicroTime  [line 266]

  static int getMicroTime( [string $mircrotime = null], [string $get_as_float = false]  )

获取微秒数

Parameters:
string   $mircrotime:  微妙时间,默认为null则获取当前时间
string   $get_as_float:  获取微妙时间是否以浮点数返回,默认为false即不以浮点数方式返回

API Tags:
Access:  public


[ Top ]
static method getPeriodOfTime  [line 216]

  static string getPeriodOfTime( [int $hour = null]  )

取得一天中的时段

Parameters:
int   $hour:  小时,默认为null则获取当前时间

API Tags:
Access:  public


[ Top ]
static method getRealDaysInMonthsOfYear  [line 138]

  static array getRealDaysInMonthsOfYear( string $year  )

得到一年中每个月真实的天数

Parameters:
string   $year:  需要获得的月份天数的年份

API Tags:
Return:  每月的天数组成的数组
Access:  public


[ Top ]
static method getRFCDate  [line 178]

  static string getRFCDate( [ $date = null], string $data  )

取得RFC格式的日期与时间

Parameters:
string   $data:  需要获取的时间,默认为null则获取当前时间
   $date: 

API Tags:
Access:  public


[ Top ]
static method getTimeStamp  [line 286]

  static int getTimeStamp( [int $dateTime = null]  )

获得时间戳

Parameters:
int   $dateTime:  时间戳,默认为null则以当前时间戳返回

API Tags:
Access:  public


[ Top ]
static method getTimeZone  [line 18]

  static string getTimeZone( )

获取时区


API Tags:
Access:  public


[ Top ]
static method getUTCDate  [line 247]

  static string getUTCDate( [mixed $dateTime = null]  )

获取UTC日期格式

Parameters:
mixed   $dateTime:  时间,默认为null则获取当前时间

API Tags:
Access:  public


[ Top ]
static method isLeapYear  [line 276]

  static boolean isLeapYear( int $year  )

判断是否是闰年

Parameters:
int   $year:  需要判断的年份

API Tags:
Return:  如果是润年则返回true
Access:  public


[ Top ]
static method setTimezone  [line 27]

  static void setTimezone( string $timezone  )

设置时区

Parameters:
string   $timezone:  时区

API Tags:
Access:  public


[ Top ]

Documentation generated on Fri, 30 Mar 2012 11:43:30 +0800 by phpDocumentor 1.4.4