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 parse datetime with milliseconds and timezone? #825

Open
StasLina opened this issue Apr 30, 2024 · 1 comment
Open

How to parse datetime with milliseconds and timezone? #825

StasLina opened this issue Apr 30, 2024 · 1 comment

Comments

@StasLina
Copy link

I'm trying to convert the date and time with the time zone and milliseconds, but it doesn't work. How can this be done correctly? Without milliseconds it works, but me need milliseconds too.

    std::istringstream in{ "2024-04-30T10:31:38.326+03:00" };
    sys_seconds tp;
    in >> date::parse("%FT%T%Ez", tp);
@StasLina StasLina changed the title How to convert datetime with milliseconds and timezone? How to parse datetime with milliseconds and timezone? Apr 30, 2024
@HowardHinnant
Copy link
Owner

HowardHinnant commented Apr 30, 2024

Change:

sys_seconds tp;

to:

sys_time<milliseconds> tp;

(adding namespace qualifiers if necessary)

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

2 participants