date default timezone set

im very new to php dont understand it to well but im trying my best to learn

im wondering if there is a way to get “date default timezone set” to show 12 hour time rather then 24 and if it can get the date as well?

any help will be great

Thanks

Hi there,

If you want the current time in 12 hour format, simply use:
[php]echo date(“h:i:s”);
[/php]

that worked but is there a way for it to show am/pm next to it?

date_default_timezone_set(‘Europe/Dublin’);

echo "Europe/Dublin: ";

echo date(“H:i:s”);

echo “

”;

[php]date_default_timezone_set(‘Europe/Dublin’);

echo "Europe/Dublin: ";

echo date(“H:i:s”);

echo “

”;[/php]

sorry for not using tags in last one

Hi there,

No problem, for lowercase am/pm use “a” or uppercase, “A”:
[php]date(“h:i:s a”);
[/php]

Would output 02:03:13 pm

For more information about the date() function: http://uk2.php.net/manual/en/function.date.php

Sponsor our Newsletter | Privacy Policy | Terms of Service