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

How to remove milliseconds from ISO formatted date using luxon #862

Closed
Deepads opened this issue Feb 4, 2021 · 5 comments
Closed

How to remove milliseconds from ISO formatted date using luxon #862

Deepads opened this issue Feb 4, 2021 · 5 comments

Comments

@Deepads
Copy link

Deepads commented Feb 4, 2021

How to remove milliseconds from ISO formatted date using luxon

Using moment :
moment().tz( 'America/New_York').format(); - o/p = 2021-02-04T07:06:52-05:00

Using Luxon:
DateTime.fromJSDate(new Date(), { zone: 'America/New_York' }).toISO({ suppressMilliseconds: true })- o/p - 2021-02-04T07:06:52.914-05:00

how to remove milliseconds or any alternative to get the ISO date in the above format without millisecond in luxon

@Deepads
Copy link
Author

Deepads commented Feb 4, 2021

As per the document { suppressMilliseconds: true } will only work if the value is 0

@EzeGmnz
Copy link

EzeGmnz commented Apr 2, 2023

The following PR solves this by adding a new parameter #1412

@Deepads
Copy link
Author

Deepads commented Sep 14, 2023

Thank you !!!

@Deepads Deepads closed this as completed Sep 14, 2023
@Deepads
Copy link
Author

Deepads commented Sep 14, 2023

Issue is fixed

@razvanioan
Copy link

Is it possible to add the same parameter to other format methods, like toSQL for example ?

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

3 participants