0

I am trying to display Indian time in a text box using PHP , my script is working but there is no 'AM' or 'PM' . I am getting the time with AM or PM when i am using echo statement . Help me please .....


this is the screen shot - [img]http://i25.tinypic.com/dphmjo.png[/img]

<body>

<?php
$time_now = mktime( date('h')+5, date('i')+30, date('s') );
$gmt1 = date('h:i:s A', $time_now);
echo $gmt1; 
?>

<br> 
<br>


<input name="textfield" type="text" disabled="True" value= <?php echo $gmt1; ?>  >

      
</body>
2
Contributors
5
Replies
7
Views
7 Years
Discussion Span
Last Post by cwarn23
0

A simple html error. Try this:

<body>
<?php
$time_now = mktime( date('h')+5, date('i')+30, date('s') );
$gmt1 = date('h:i:s A', $time_now);
echo $gmt1; 
?>
<br> 
<br>
<input name="textfield" type="text" disabled="True" value="<?php echo $gmt1; ?>"  >
</body>
0

thanks for u r help , now its working . Can u tell me what is the error ..

0

thanks for u r help , now its working . Can u tell me what is the error ..

The error was two quotation marks that needed adding in the following line.

<input name="textfield" type="text" disabled="True" value= <?php echo $gmt1; ?>  >

above was replaced with below

<input name="textfield" type="text" disabled="True" value="<?php echo $gmt1; ?>"  >

Very very minor but with different results.

0

thanks for u r help , one more thing how to display in the following fromat.....

11:30 AM Sunday , August 25 , 2009

0

thanks for u r help , one more thing how to display in the following fromat.....

11:30 AM Sunday , August 25 , 2009

Try this:

<body>
<?php
$time_now = mktime( date('h')+5, date('i')+30, date('s') );
$gmt1 = date('h:i:s A l, F j, Y', $time_now);
echo $gmt1; 
?>
<br> 
<br>
<input name="textfield" type="text" disabled="True" value="<?php echo $gmt1; ?>"  style="width: 256px;">
</body>
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.