hi i am doing a attendance sheet appln...
i want to know how to get the current indian time,date,month and year.....
and i want to store that in mysql database

lydia

<?php
$time_now=mktime(date('h')+5,date('i')+30,date('s'));
 print "<br>".date('h:i:s A',$time_now);
?>

Thats for php.

Cheers,
Naveen

I am getting the right output. i am getting 03:14:16 PM which is the right time.

$time_now=mktime(date('h')+5,date('i')+30,date('s'));

date('h')+5 will add 5 hrs to UTC time.
date('i')+30 will add 30 mins to UTC time.

Since we are 5-30 hrs ahead of UTC time, i am sure this will work. It probably wont work if you have set some other timezone. :)

can i know why u have given "<br>"...

Time<input type="text" name="dat1" value=<?php

$time_now=mktime(date('h')+5,date('i')+30,date('s'));

print .date('h:i:s A',$time_now);

?>>

because the about statement is not working

<br> is to give a line break. That doesnt make any difference. Do you want indian time to be put in a text box ? Try this.

<html>
<body>
<?php
$time_now=mktime(date('h')+5,date('i')+30,date('s'));
$time_now=date('h:i:s A',$time_now);
?>
Time: <input type="text" name="dat1" value="<?php echo $time_now; ?>">
</body>
</html>

Hi this is sunil,
pls see this code,

$time_now=gmmktime(date('h')+5,date('i')+30,date('s'));

print "<br>".date('h:i:s A',$time_now);

just use two line of codes...

$date = date_default_timezone_set('Asia/Kolkata');
$today = date("F j, Y, g:i a T");

in the php code and use $date where you want your values to reflect...That's it.

Comments
correct

Use Time Zone

<?php

$date = date_default_timezone_set('Asia/Kolkata');

echo date("d/m/Y h:i:s a", time());

?>
Or Use Time Diferrence from GMT
<?php

$time_now=mktime(date('h')+5,date('i')+30,date('s'));

echo date("d/m/Y h:i:s a", time());

?>

This question has already been answered. Start a new discussion instead.