note 22117 added to function.date
| From: | kloining at powadezign dot no | Date: | Fri, 07 Jun 2002 09:58:35 +0000 |
| Subject: | note 22117 added to function.date | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31555@lists.php.net to get a copy of this message | ||
So, here's a really simple script to print out a user-friendly date and time.
This is written for Norwegian standards, but you can easely edit $now to change the format.
<?
$day = date(j); //one digit
$month = date(m); //two digits
$year = date(Y); //four digits
$clock = (date(H).":".date(i)); //24H
if ($month == 01){
$monthnow = "January";
}
elseif ($month == 02){
$monthnow = "February";
}
elseif ($month == 03){
$monthnow = "March";
}
elseif ($month == 04){
$monthnow = "April";
}
elseif ($month == 05){
$monthnow = "May";
}
elseif ($month == 06){
$monthnow = "June";
}
elseif ($month == 07){
$monthnow = "July";
}
elseif ($month == 08){
$monthnow = "August";
}
elseif ($month == 09){
$monthnow = "September";
}
elseif ($month == 10){
$monthnow = "October";
}
elseif ($month == 11){
$monthnow = "November";
}
elseif ($month == 12){
$monthnow = "December";
}
$now = ("$clock - $day. $monthnow $year");
print $now;
?>
--
http://www.php.net/manual/en/function.date.php
http://master.php.net/manage/user-notes.php?action=edit+22117
http://master.php.net/manage/user-notes.php?action=delete+22117
http://master.php.net/manage/user-notes.php?action=reject+22117