Find month, year, day, date and time using php strftime

This Comment will be submitted for moderation and will not be accessible to other users until it has been approved.


strftime("%D",$timestamp) : Mon

%A - full weekday name according to the current locale

strftime("%A",$timestamp) : Monday

%b - abbreviated month name according to the current locale

strftime("%b",$timestamp) : Nov

%B - full month name according to the current locale

strftime("%B",$timestamp) : November

%c - preferred date and time representation for the current locale

strftime("%c",$timestamp) : Mon Nov 26 14:31:06 2007

%C - century number (the year divided by 100 and truncated to an integer, range 00 to 99).

strftime("%C",$timestamp) : 20
 
strftime("%d",$timestamp) : 26 

%D - same as %m/%d/%y

strftime("%D",$timestamp) : 11/26/07

%e - day of the month as a decimal number, a single digit is preceded by a space (range ' 1' to '31')

strftime("%e",$timestamp) : 26

%g - like %G, but without the century.

strftime("%g",$timestamp) : 07

%G - The 4-digit year corresponding to the ISO week number (see %V). This has the same format and value as %Y, except that if the ISO week number belongs to the previous or next year, that year is used instead.

strftime("%G",$timestamp) : 2007

%h - same as %b

strftime("%h",$timestamp) : Nov

%H - hour as a decimal number using a 24-hour clock (range 00 to 23)

strftime("%H",$timestamp) : 14

%I - hour as a decimal number using a 12-hour clock (range 01 to 12)

strftime("%I",$timestamp) : 02

%j - day of the year as a decimal number (range 001 to 366)

strftime("%j",$timestamp) : 330

%m - month as a decimal number (range 01 to 12)

strftime("%m",$timestamp) : 11

%M - minute as a decimal number

strftime("%M",$timestamp) : 31

%n - newline character

%p - either 'am' or 'pm' according to the given time value, or the corresponding strings for the current locale

strftime("%p",$timestamp) : PM

%r - time in a.m. and p.m. notation

strftime("%r",$timestamp) : 02:31:06 PM

%R - time in 24 hour notation

strftime("%R",$timestamp) : 14:31

%S - second as a decimal number

strftime("%S",$timestamp) : 06

%t - tab character

%T - current time, equal to %H:%M:%S

strftime("%T",$timestamp) : 14:31:06

%u - weekday as a decimal number [1,7], with 1 representing Monday. Sun Solaris seems to start with Sunday as 1.

strftime("%u",$timestamp) : 1

%U - week number of the current year as a decimal number, starting with the first Sunday as the first day of the first week

strftime("%U",$timestamp) : 47

%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.)

strftime("%V",$timestamp) : 48

%W - week number of the current year as a decimal number, starting with the first Monday as the first day of the first week.

strftime("%W",$timestamp) : 48

%w - day of the week as a decimal, Sunday being 0.

strftime("%w",$timestamp) : 1

%x - preferred date representation for the current locale without the time.

strftime("%x",$timestamp) : 11/26/07

%X - preferred time representation for the current locale without the date.

strftime("%X",$timestamp) : 14:31:06

%y - year as a decimal number without a century (range 00 to 99).

strftime("%y",$timestamp) : 07

%Y - year as a decimal number including the century.

strftime("%Y",$timestamp) : 2007

%Z - time zone or name or abbreviation.

strftime("%Z",$timestamp) : UTC

 
                                     
10 points

hi,
sorry someone know what is a decimal yearday?
i have a hours from 0 to 23 and have to change in yaerday..how can i do?
thanks

Anonymous's picture
Created by Anonymous

Post Comment

  • You can enable syntax highlighting of source code with the following tags: <code>, <blockcode>, <c>, <cpp>, <drupal5>, <drupal6>, <java>, <javascript>, <php>, <python>, <ruby>. Beside the tag style "<foo>" it is also possible to use "[foo]". PHP source code can also be enclosed in <?php ... ?> or <% ... %>.