Get Full date with time using PHP
For Getting date there is a Function "date" which accept argument and Return sa the argument pass to it.
Example is:
<?php
// assume today date is 06th October 2014
echo date('Y-m-d'); // will print 2014-10-06
echo date('y-m-d'); // will print 14-10-06
/*there is different between each capital and small character, which passes on argument. See the abov output.*/
?>
For Getting Default TimeZone
<?php
/*
this function "date_default_timezone_set" is used for setting the timezone on the script.
*/
date_default_timezone_set('Asia/Kolkata')
/*this will set Indian Timezone, You can get list from herehttp://php.net/manual/en/timezones.php*/
?>
<?php
date("Y-m-d H:i:s");// output: 2014-10-06 14:01:36
?>
Comments
Post a Comment