php - Inconsistent strtotime conversions -
when doing conversion on date using strtotime, i'm getting inconsistent results.
array[0] holds date converted:
original -> converted -> converted array ([0] => 30.01.15) -> 1422576000 -> gmt: fri, 30 jan 2015 00:00:00 gmt array ([0] => 23.01.15) -> 1427925675 -> gmt: wed, 01 apr 2015 22:01:15 gmt
when using dashes, instead of dots, get:
array ([0] => 30-01-15) -> 1894665600 -> gmt: tue, 15 jan 2030 00:00:00 gmt array ([0] => 23-01-15) -> 1673740800 -> gmt: sun, 15 jan 2023 00:00:00 gmt
it works in first instance, using dots, in second using dots todays date? ideas might causing inconsistency?
according php manual, date , time must provided in supported date/time format: http://php.net/manual/en/datetime.formats.date.php
the "dot" notation not seem supported date values, php tries parse time, here's why got "strange" behaviour.
to better explain different behave: in first run 30 cannot interpreted hour value, php tries date parsing, in second run, 23 it's reasonable hour value, goes time.
the "day, month , 2 digit year, dots or tabs" format (dd [.\t] mm "." yy) works year values 61 (inclusive) 99 (inclusive) - outside years time format "hh [.:] mm [.:] ss" has precedence
Comments
Post a Comment