Skip to content
Discussion options

You must be logged in to vote

moment("5/11/2024 3:00:31 PM", "M/D/YYYY h:mm:ss a").locale('en').utcOffset(0, true).unix()

In your code example, you're only calling .locale('en') after the parsing has already happened. That snippet is not trying to parse the string in en locale; it's trying to parse the string in the global locale then use the en locale afterwards.

Replies: 14 comments

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

This comment was marked as spam.

Comment options

You must be logged in to vote
0 replies
Answer selected by mattjohnsonpint

This comment has been hidden.

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants
Converted from issue

This discussion was converted from issue #6234 on August 23, 2026 07:47.