PHP 클래스 Prado\I18N\core\DateFormat

The DateFormat class allows you to format dates and times with predefined styles in a locale-sensitive manner. Formatting times with the DateFormat class is similar to formatting dates. Formatting dates with the DateFormat class is a two-step process. First, you create a formatter with the getDateInstance method. Second, you invoke the format method, which returns a string containing the formatted date. DateTime values are formatted using standard or custom patterns stored in the properties of a DateTimeFormatInfo.
파일 보기 프로젝트 열기: pradosoft/prado 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$formatInfo DateTimeFormatInfo The DateTimeFormatInfo, containing culture specific patterns and names.
$methods array A list of methods, to be used by the token function calls.
$tokens array A list of tokens and their function call.

공개 메소드들

메소드 설명
__construct ( $formatInfo = null ) : DateFormat Initialize a new DateFormat.
format ( $time, $pattern = 'F', $charset = 'UTF-8' ) : string Format a date according to the pattern.

보호된 메소드들

메소드 설명
getAMPM ( $date, $pattern = 'a' ) : string Get the AM/PM designator, 12 noon is PM, 12 midnight is AM.
getDay ( $date, $pattern = 'd' ) : string Get the day of the month.
getDayInMonth ( $date, $pattern = 'FF' ) : integer Get day in the month.
getDayInWeek ( $date, $pattern = 'EEEE' ) : string Get the day of the week.
getDayInYear ( $date, $pattern = 'D' ) : integer Get the day in the year, e.g. [1-366]
getEra ( $date, $pattern = 'G' ) : string Get the era. i.e. in gregorian, year > 0 is AD, else BC.
getFunctionName ( $token ) : mixed For a particular token, get the corresponding function to call.
getHour12 ( $date, $pattern = 'h' ) : string Get the hours in 12 hour format.
getHour24 ( $date, $pattern = 'H' ) : string Get the hours in 24 hour format, i.e. [0-23].
getHourInAMPM ( $date, $pattern = 'K' ) : integer Get the hours in AM/PM format, e.g [1-12]
getHourInDay ( $date, $pattern = 'k' ) : integer Get the hours [1-24].
getMinutes ( $date, $pattern = 'm' ) : string Get the minutes.
getMonth ( $date, $pattern = 'M' ) : string Get the month.
getPattern ( $pattern ) : string Get the pattern from DateTimeFormatInfo or some predefined patterns.
getSeconds ( $date, $pattern = 's' ) : string Get the seconds.
getTimeZone ( $date, $pattern = 'z' ) : string Get the timezone from the server machine.
getTokens ( $pattern ) : array Tokenize the pattern. The tokens are delimited by group of similar characters, e.g. 'aabb' will form 2 tokens of 'aa' and 'bb'.
getWeekInMonth ( $date, $pattern = 'W' ) : integer Get week in the month.
getWeekInYear ( $date, $pattern = 'w' ) : integer Get the week in the year.
getYear ( $date, $pattern = 'yyyy' ) : string Get the year.

메소드 상세

__construct() 공개 메소드

Initialize a new DateFormat.
public __construct ( $formatInfo = null ) : DateFormat
리턴 DateFormat instance

format() 공개 메소드

Format a date according to the pattern.
public format ( $time, $pattern = 'F', $charset = 'UTF-8' ) : string
리턴 string formatted date time.

getAMPM() 보호된 메소드

Get the AM/PM designator, 12 noon is PM, 12 midnight is AM.
protected getAMPM ( $date, $pattern = 'a' ) : string
리턴 string AM or PM designator

getDay() 보호된 메소드

"d" for non-padding, "dd" will always return 2 characters.
protected getDay ( $date, $pattern = 'd' ) : string
리턴 string day of the month

getDayInMonth() 보호된 메소드

Get day in the month.
protected getDayInMonth ( $date, $pattern = 'FF' ) : integer
리턴 integer day in month

getDayInWeek() 보호된 메소드

"E" will return integer 0 (for Sunday) through 6 (for Saturday). "EE" will return the narrow day of the week, e.g. "M" "EEE" will return the abrreviated day of the week, e.g. "Mon" "EEEE" will return the day of the week, e.g. "Monday"
protected getDayInWeek ( $date, $pattern = 'EEEE' ) : string
리턴 string day of the week.

getDayInYear() 보호된 메소드

Get the day in the year, e.g. [1-366]
protected getDayInYear ( $date, $pattern = 'D' ) : integer
리턴 integer hours in AM/PM format.

getEra() 보호된 메소드

Get the era. i.e. in gregorian, year > 0 is AD, else BC.
protected getEra ( $date, $pattern = 'G' ) : string
리턴 string era

getFunctionName() 보호된 메소드

For a particular token, get the corresponding function to call.
protected getFunctionName ( $token ) : mixed
리턴 mixed the function if good token, null otherwise.

getHour12() 보호된 메소드

"h" for non-padding, "hh" will always return 2 characters.
protected getHour12 ( $date, $pattern = 'h' ) : string
리턴 string hours in 12 hour format.

getHour24() 보호된 메소드

"H" for non-padding, "HH" will always return 2 characters.
protected getHour24 ( $date, $pattern = 'H' ) : string
리턴 string hours in 24 hour format.

getHourInAMPM() 보호된 메소드

Get the hours in AM/PM format, e.g [1-12]
protected getHourInAMPM ( $date, $pattern = 'K' ) : integer
리턴 integer hours in AM/PM format.

getHourInDay() 보호된 메소드

Get the hours [1-24].
protected getHourInDay ( $date, $pattern = 'k' ) : integer
리턴 integer hours [1-24]

getMinutes() 보호된 메소드

"m" for non-padding, "mm" will always return 2 characters.
protected getMinutes ( $date, $pattern = 'm' ) : string
리턴 string minutes.

getMonth() 보호된 메소드

"M" will return integer 1 through 12 "MM" will return the narrow month name, e.g. "J" "MMM" will return the abrreviated month name, e.g. "Jan" "MMMM" will return the month name, e.g. "January"
protected getMonth ( $date, $pattern = 'M' ) : string
리턴 string month name

getPattern() 보호된 메소드

If the $pattern parameter is an array of 2 element, it will assume that the first element is the date, and second the time and try to find an appropriate pattern and apply DateTimeFormatInfo::formatDateTime See the tutorial documentation for futher details on the patterns.
또한 보기: DateTimeFormatInfo::formatDateTime()
protected getPattern ( $pattern ) : string
리턴 string a pattern.

getSeconds() 보호된 메소드

"s" for non-padding, "ss" will always return 2 characters.
protected getSeconds ( $date, $pattern = 's' ) : string
리턴 string seconds

getTimeZone() 보호된 메소드

Get the timezone from the server machine.
protected getTimeZone ( $date, $pattern = 'z' ) : string
리턴 string time zone

getTokens() 보호된 메소드

Any substrings, starting and ending with a single quote (') will be treated as a single token.
protected getTokens ( $pattern ) : array
리턴 array string tokens in an array.

getWeekInMonth() 보호된 메소드

Get week in the month.
protected getWeekInMonth ( $date, $pattern = 'W' ) : integer
리턴 integer week in month

getWeekInYear() 보호된 메소드

Get the week in the year.
protected getWeekInYear ( $date, $pattern = 'w' ) : integer
리턴 integer week in year

getYear() 보호된 메소드

"yy" will return the last two digits of year. "yyyy" will return the full integer year.
protected getYear ( $date, $pattern = 'yyyy' ) : string
리턴 string year

프로퍼티 상세

$formatInfo 보호되어 있는 프로퍼티

The DateTimeFormatInfo, containing culture specific patterns and names.
protected DateTimeFormatInfo,Prado\I18N\core $formatInfo
리턴 DateTimeFormatInfo

$methods 보호되어 있는 프로퍼티

A list of methods, to be used by the token function calls.
protected array $methods
리턴 array

$tokens 보호되어 있는 프로퍼티

A list of tokens and their function call.
protected array $tokens
리턴 array