Indian date-time function plz?

Reply

Join Date: Aug 2008
Posts: 161
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster

Indian date-time function plz?

 
-2
  #1
Oct 30th, 2009
Hi frnds...

i m using date time funtion in many ways..but i m not getting indian timings...plz tell me how can i exact indian timings...

i used all the below functions...

php_value date.timezone "Asia/Calcutta"
echo date('d-m-Y H:i:s');

putenv("TZ=Europe/Istanbul");

i need only for a single page..
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 130
Reputation: hemgoyal_1990 is an unknown quantity at this point 
Solved Threads: 8
hemgoyal_1990's Avatar
hemgoyal_1990 hemgoyal_1990 is offline Offline
Junior Poster
 
0
  #2
Oct 30th, 2009
Originally Posted by sarithak View Post
Hi frnds...

i m using date time funtion in many ways..but i m not getting indian timings...plz tell me how can i exact indian timings...

i used all the below functions...



i need only for a single page..

You May Use the Below Specified Script for Getting Indian Time in Text Box:

  1. <html>
  2. <body>
  3. <?php
  4. $time_now=mktime(date('h')+5,date('i')+30,date('s'));
  5. $time_now=date('h:i:s A',$time_now);
  6. ?>
  7. Time: <input type="text" name="dat1" value="<?php echo $time_now; ?>">
  8. </body>
  9. </html>
http://www.kuchamancity.com
Hem Web Solution..
Behind Every Successful Man, There is an Untold Pain in His Heart.
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 161
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster
 
0
  #3
Oct 30th, 2009
Hi hemgoyal,

Thanks for ur reply..
here i m getting wrong time...now i m in INDIA..here present time is 11.26 am......but the code displays 04:25:59 PM...

i need indian time zone ..i m using database MYSQL...


plz tell me...
Originally Posted by hemgoyal_1990 View Post
You May Use the Below Specified Script for Getting Indian Time in Text Box:

  1. <html>
  2. <body>
  3. <?php
  4. $time_now=mktime(date('h')+5,date('i')+30,date('s'));
  5. $time_now=date('h:i:s A',$time_now);
  6. ?>
  7. Time: <input type="text" name="dat1" value="<?php echo $time_now; ?>">
  8. </body>
  9. </html>
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 557
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 64
network18 network18 is offline Offline
Posting Pro
 
0
  #4
Oct 30th, 2009
using just -
  1. date_default_timezone_set("Asia/Calcutta");
  2. $d = date('Y-m-d H:i:s');
should do actually.what is the problem with this.
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 161
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster
 
0
  #5
Oct 30th, 2009
hey...thank U...

this time i m getting error...

error:
PHP Fatal error: Call to undefined function: date_default_timezone_set()

Originally Posted by network18 View Post
using just -
  1. date_default_timezone_set("Asia/Calcutta");
  2. $d = date('Y-m-d H:i:s');
should do actually.what is the problem with this.
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 102
Reputation: jomanlk is an unknown quantity at this point 
Solved Threads: 18
jomanlk jomanlk is offline Offline
Junior Poster
 
0
  #6
Oct 30th, 2009
What is the version of PHP that you are using?
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 557
Reputation: network18 is an unknown quantity at this point 
Solved Threads: 64
network18 network18 is offline Offline
Posting Pro
 
0
  #7
Oct 30th, 2009
Its clear you are running the older version of PHP and the date_default_timezone_set() is not supported.
check date.timezone in php.ini
"The discipline of writing something down is the first step towards making it happen."

follow me on twitter
Reply With Quote Quick reply to this message  
Join Date: Aug 2008
Posts: 161
Reputation: sarithak is an unknown quantity at this point 
Solved Threads: 6
sarithak sarithak is offline Offline
Junior Poster
 
0
  #8
Oct 30th, 2009
in my system i m using php version ...5.3.0....

in php.ini..

date.timezone = UTC

Originally Posted by network18 View Post
Its clear you are running the older version of PHP and the date_default_timezone_set() is not supported.
check date.timezone in php.ini
My best wishes ... from my soul ... for everyone!
Keep Smiling....Never Depress
Reply With Quote Quick reply to this message  
Join Date: Aug 2007
Posts: 130
Reputation: hemgoyal_1990 is an unknown quantity at this point 
Solved Threads: 8
hemgoyal_1990's Avatar
hemgoyal_1990 hemgoyal_1990 is offline Offline
Junior Poster
 
0
  #9
Oct 30th, 2009
You may Use The Below Specified Code. This Code is Work Fine for Me:

  1. <?PHP
  2. $time_now=mktime(date('h'),date('i'),date('s'));
  3. $time_now=date('h:i:s',$time_now);
  4. $time_zone=date('P'); //This will show Time Zone
  5. echo "The Current Time Zone is $time_zone and Date is: ";
  6. echo gmdate("M d Y"); //Date Creation
  7. echo " Time is: $time_now";
  8. ?>
http://www.kuchamancity.com
Hem Web Solution..
Behind Every Successful Man, There is an Untold Pain in His Heart.
Reply With Quote Quick reply to this message  
Join Date: Oct 2009
Posts: 102
Reputation: jomanlk is an unknown quantity at this point 
Solved Threads: 18
jomanlk jomanlk is offline Offline
Junior Poster
 
0
  #10
Oct 30th, 2009
hmmm, your PHP version is fine.

Can you not run the code hemgoyal_1990 included in the above post?

Try running the following code to figure out your actual runtime PHP version if it still gives you a function missing error.

  1. <?php echo 'Current PHP version: ' . phpversion(); ?>
Reply With Quote Quick reply to this message  
Reply

Message:



Other Threads in the PHP Forum


Views: 1249 | Replies: 27
Thread Tools Search this Thread



Tag cloud for PHP
About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC