note 81946 deleted from function.date by danbrown
| From: | danbrown@php.net | Date: | Sun, 17 May 2009 18:57:35 +0000 |
| Subject: | note 81946 deleted from function.date by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-155192@lists.php.net to get a copy of this message | ||
Note Submitter: ash at atomic-network dot co dot uk
----
in regards to: [takzik at ebanat dot com]
simplest way of displaying / formatting dates. strtotime()
<?php
# Date: y-m-d => d-m-y
$time =explode("-","2008-01-01");
krsort($time);
print implode("-",$time);
?>
<p>Will return: 01-01-2008.
<?php
# Date: d-m-y => y-m-d
$time =explode("-","01-01-2008");
krsort($time);
print "<p>".implode("-",$time);
?>
<p>Will return: 2008-01-01.
<?php
# Quickest: Y-m-d => American Format
print date("m-d-Y",strtotime("2008-02-01"));
?>
<p>Will return: 02-01-2008.
<?php
# Quickest: Y-m-d => Brittish Format
print date("d.m.Y",strtotime("2008-01-01"));
?>
<p>Will return: 01.01.2008.