strftime
(PHP 3, PHP 4 , PHP 5)
strftime -- 지역 설정에 따라 로컬 시간/날짜를 형식화한다.
Description
string strftime ( string format [, int timestamp])
date()함수와 동일한 역할을 수행하여 함수 호출 시에 지정해 준 format에 날짜 정보를 출력한다.
setlocale("LC_TIME","ko") 로 설정하면 월명이나 요일명을 한글로 출력할 수도 있다.
다음의 변환 지시자들은 형식화된 문자열로 간주된다.
%a - 현재 지역 설정에 따라 축약된 요일 이름이 반환된다.
%A - 현재 지역 설정에 따라 전체 요일 이름이 반환된다.
%b - 현재 지역 설정에 따라 축약된 월 이름이 반환된다.
%B - 현재 지역 설정에 따라 전체 월 이름이 반환된다.
%d - 일자를 두자리로 출력한다.(01~31)
%e - 일자를 출력하되 10보다 작은 일자는 한자리로 출력.
%H - 시간을 24시간제로 출력 (00~23)
%I - 시간을 12시간제로 출력(01~12)
%j - 일자를 365로 출력
%m - 월 출력(01~12)
%M - 분 출력
%n - 줄바꿈
%p - 오전 오후 출력
%r - time in a.m. and p.m. notation / AM. PM 표기법
%R - time in 24 hour notation / 24시간 표기법
%S - second as a decimal number
%t - tab character
%T - current time, equal to %H:%M:%S
%u - weekday as a decimal number [1,7], with 1 representing Monday
주의
Sun Solaris seems to start with Sunday as 1 although ISO 9889:1999 (the current C standard) clearly specifies that it should be Monday.
%U - week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week
%V - The ISO 8601:1988 week number of the current year as a decimal number, range 01 to 53, where week 1 is the first week that has at least 4 days in the current year, and with Monday as the first day of the week. (Use %G or %g for the year component that corresponds to the week number for the specified timestamp.)
%W - week number of the current year as a decimal number, starting with the first Monday as the first day of the first week
%w - day of the week as a decimal, Sunday being 0
%x - preferred date representation for the current locale without the time
%X - preferred time representation for the current locale without the date
%y - year as a decimal number without a century (range 00 to 99)
%Y - year as a decimal number including the century
%Z - time zone or name or abbreviation
%% - a literal `%' character