date_default_timezone_set("Asia/Singapore");
$today = date("d-F-Y");
$timenow = date("H:i:s A");
<p>The date and time now is <?php echo $today?> <?php echo $timenow?></p>
Refer to the timezones here: http://www.php.net/manual/en/timezones.asia.php
Refer to the full date functions php reference here: http://www.php.net/manual/en/function.date.php
Symbol | Meaning | Example |
---|---|---|
F | Month in text, not abbreviated | January |
M | Month in text, abbreviated | Jan |
m | Month in numbers with leading zeros | 02, 12 |
n | Month in numbers without leading zeros | 1, 12 |
d | Day of the month; two digits with leading zeros | 01, 14 |
j | Day of the month without leading zeros | 3, 30 |
l | Day of the week in text, not abbreviated | Friday |
D | Day of the week in text, abbreviated | Fri |
w | Day of the week in numbers | From 0 (Sunday) to 6 (Saturday) |
Y | Year in four digits | 2011 |
y | Year in two digits | 11 |
g | Hour between 0 and 12 without leading zeros | 1, 11 |
G | Hour between 0 and 24 without leading zeros | 2, 15 |
h | Hour between 0 and 12 with leading zeros | 02, 10 |
H | Hour between 0 and 24 with leading zeros | 00, 23 |
i | Minutes | 00, 59 |
s | Seconds | 00, 59 |
a | am or pm in lowercase | am, pm |
A | AM or PM in uppercase | AM, PM |
No comments:
Post a Comment