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

; Defines the default timezone used by the date functions
;date.timezone =


; Defines the default timezone used by the date functions
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.



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
answered 7 Months ago

Try this:

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

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
answered 5 Months ago

Now there is an official example here:

Thursday, August 12, 2021
answered 3 Months ago

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
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 :