xp-framework/core

Date precision

thekid opened this issue · 2 comments

$ xp -d 'new \util\Date()'
object(util\Date)#49 (1) {
  ["handle":"util\Date":private]=>
  object(DateTime)#50 (3) {
    ["date"]=>
    string(26) "2019-07-03 15:18:10.393313"
    ["timezone_type"]=>
    int(3)
    ["timezone"]=>
    string(13) "Europe/Berlin"
  }
}

Internally, microseconds (.393313 in the above example) are present, the Date class however does not have accessors for these

See https://www.php.net/manual/en/function.date.php

format character Description
u Microseconds (added in PHP 5.2.2). Note that date() will always generate 000000 since it takes an integer parameter, whereas DateTime::format() does support microseconds if DateTime was created with microseconds.

Developed in feature branch feature/date-precision - initial commit for testing: 3c12b27e6.

May only work with PHP 7.1+ ➡️ https://travis-ci.org/xp-framework/core/builds/553793443