Loans - Mortgage Loans - Mobile Phones - Credit Counseling - Property for sale in Spain

PDA

View Full Version : How to display Indian Date in text box (php form)


nkurahatti
Dec 3rd 2007, 9:35 pm
Dear All,

I am new to PHP programming. I have very little knowledge in php.

I want to know how to display current Indian date in textbox (php form)
Date should load on form load event.

I used following date function
<?php echo date("d/m/Y");?>

The problem is server is in USA
So textbox showing US date!

But I need Indian date
Date format (dd/mm/yyyy)

Thanks and regards
Narayan K
India

zyml
Dec 3rd 2007, 11:31 pm
You'll probably have to add the difference in hours between the time in US and India to the current time. Use date() to get the current hour and add the difference, then use the mktime() function to generate the date in Indian timezone.

Evoleto
Dec 3rd 2007, 11:59 pm
But I need Indian date
Date format (dd/mm/yyyy)


Try the following code:

echo date( "d/m/Y" );

anantk
Dec 4th 2007, 3:37 am
if your server is on USA Central time, you'll have to set the code up to add 11.5 hrs to the time to match with IST