Showing posts with label time. Show all posts
Showing posts with label time. Show all posts

Friday, October 10, 2008

how to change month number to month name?

how to change month no to month name?
link 02 to february or Feb...

function month_name($month_no)
{
$timestmp = mktime(0,0,0,$month_no,1,2008);
return date("M",$timestmp);
}

echo month_name(10); //will return October
?>


Cheers!

Wednesday, April 16, 2008

Changing / Setting Server Timezone in PHP

<?
session_start();
ob_start();
echo '1 '.date("d-m-Y H:i:s"); // Default server time zone

putenv("TZ=Asia/Calcutta"); //change your server time zone - this one is for India - works in PHP 4
// also you can try: date_default_timezone_set('Asia/Shanghai'); - since PHP 5.1.0

echo '2 '.date("d-m-Y H:i:s");

//Reference:
// http://in.php.net/manual/en/function.date.php
// http://in.php.net/manual/en/timezones.php
// http://in.php.net/manual/en/function.date-default-timezone-set.php
?>