Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format as Milliseconds rounds incorrectly #1051

Closed
leftbak opened this issue Dec 13, 2017 · 1 comment
Closed

Format as Milliseconds rounds incorrectly #1051

leftbak opened this issue Dec 13, 2017 · 1 comment

Comments

@leftbak
Copy link

leftbak commented Dec 13, 2017

If a microseconds value is between 999499 and 999999 it incorrectly rounds and truncates to .1000 when asked to format as milliseconds.

new Carbon('2017-01-01 10:00:00.999999'))->format('Y-m-d H:i:s.v')

"2017-01-01 10:00:00.1000"

Expected behaviour:

  1. Truncate to .999 or
  2. Round to "2017-01-01 10:00:01.000"

Causes problems in Laravel with SqlServer laravel/framework#22407

@leftbak
Copy link
Author

leftbak commented Dec 13, 2017

This is actually a PHP DateTime format bug

@leftbak leftbak closed this as completed Dec 13, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant