Asked  7 Months ago    Answers:  5   Viewed   31 times

I'm trying to change the default PHP timezone to Asia/Calcutta by accessing the /etc/php5/cli/php.ini file and changing

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
;date.timezone =

to

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Asia/Calcutta"

However, when I try to view current timezone under phpinfo(), the timezone follows the Europe/Berlin timezone.

I have tried stopping and restarting the Apache server, but that didn't seem to have changed the settings.

Is there something I'm missing in the process?

PS: I'm using PHP 5.6.8 currently under XAMPP.

 Answers

54

I tried all the other possible solutions posted, but none of them helped. This is what helped me save my timezone settings:

1) Go to your phpinfo() page and search for Loaded Configuration File and open the php.ini file mentioned under that section.

2) Change the default timezone settings by adding your new timezone by modifying this line: date.timezone=Asia/Kolkata.

3) Save the php.ini file and stop the Apache server.

4) Restart the Apache server. The timezone settings should now be modified.

Wednesday, March 31, 2021
 
Smandoli
answered 7 Months ago
72

Try this:

$tZone = new DateTimeZone("Europe/Amsterdam");
Saturday, May 29, 2021
 
mnagel
answered 5 Months ago
41

I'm not sure what format you're looking for in your difference but here's how to do it using DateTime

$datetime1 = new DateTime();
$datetime2 = new DateTime('2011-01-03 17:13:00');
$interval = $datetime1->diff($datetime2);
$elapsed = $interval->format('%y years %m months %a days %h hours %i minutes %s seconds');
echo $elapsed;
Friday, June 4, 2021
 
Jesse
answered 5 Months ago
41

Now there is an official example here:

https://colab.research.google.com/notebooks/forms.ipynb

Thursday, August 12, 2021
 
danjah
answered 3 Months ago
77

while setting the classpath a single dot (.) means current directory. As you jar files are in current directory, you just need to go to your current directory using cd command in DOS prompt, then use

set classpath = .;filename.jar;another filename.jar

Here . represents current directory and semicolon separates each classpaths.

You can even set classpath of more than one jar files using wild card character * which can be read as all.

Tuesday, August 17, 2021
 
the_e
answered 2 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :