php date T code example
Example 1: date php
$today = date("F j, Y, g:i a");
$today = date("m.d.y");
$today = date("j, n, Y");
$today = date("Ymd");
$today = date('h-i-s, j-m-y, it is w Day');
$today = date('\i\t \i\s \t\h\e jS \d\a\y.');
$today = date("D M j G:i:s T Y");
$today = date('H:m:s \m \e\s\t\ \l\e\ \m\o\i\s');
$today = date("H:i:s");
$today = date("Y-m-d H:i:s");
Example 2: date in php
Things to be aware of when using week numbers with years.
<?php
echo date("YW", strtotime("2011-01-07"));
echo date("YW", strtotime("2011-12-31"));
echo date("YW", strtotime("2011-01-01"));
?>
BUT
<?php
echo date("oW", strtotime("2011-01-07"));
echo date("oW", strtotime("2011-12-31"));
echo date("oW", strtotime("2011-01-01"));
?>
Reason:
Y is year from the date
o is ISO-8601 year number
W is ISO-8601 week number of year
Conclusion:
if using 'W' for the week number use 'o' for the year.
Example 3: php timestamp format
date("d.m.Y", strtotime($mysqltimestamp)
Example 4: date in php
FYI: there's a list of constants with predefined formats on the DateTime object, for example instead of outputting ISO 8601 dates with:
<?php
echo date('c');
?>
or
<?php
echo date('Y-m-d\TH:i:sO');
?>
You can use
<?php
echo date(DateTime::ISO8601);
?>
instead, which is much easier to read.
Example 5: phph date
<?php
date_default_timezone_set('UTC');
echo date("l");
echo date('l jS \of F Y h:i:s A');
echo "July 1, 2000 is on a " . date("l", mktime(0, 0, 0, 7, 1, 2000));
echo date(DATE_RFC2822);
echo date(DATE_ATOM, mktime(0, 0, 0, 7, 1, 2000));
?>
Example 6: show date php by letters
check here link: http: