Time zone "problem..."

General discussions related to php

Moderators: egami, macek, gesf

Post Reply
New php-forum User
New php-forum User
Posts: 5
Joined: Sun Jul 16, 2017 9:38 pm

Sun Jul 16, 2017 9:47 pm

Good morning,

I'm debating with a little problem. I'm dealing with dates in the future (and in the past) and whish to know, according to a time zone, the offset to UTC. So I use something like this:

Code: Select all

$dateValue = "2017-2-21 12:23";
$timezone = "Europe/Paris";
$dt = new DateTime($dateValue, new DateTimeZone($timezone));
$offset = $dt->getOffset();
My problem is getting the offset for instance of "15031-2-21 12:23". It's not accepted in the year range. I may do the math for year reduction according to the gregorian year to fake an identical year in the cycle. But...is there any simple solution for this?

Kind regards,


User avatar
php-forum Fan User
php-forum Fan User
Posts: 685
Joined: Mon Feb 22, 2016 5:52 pm

Mon Jul 17, 2017 9:09 am

I read somewhere that the limits for the year are -9999 to 9999, can't remember when, where or why though, so you may have to do something.

Post Reply