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

timestamp with miliseconds #222

Closed
jgrammen-agilitypr opened this issue May 30, 2018 · 2 comments
Closed

timestamp with miliseconds #222

jgrammen-agilitypr opened this issue May 30, 2018 · 2 comments

Comments

@jgrammen-agilitypr
Copy link

I would like to print unix time stamps (time since epoch) with milliseconds precision, there does not appear to be a function for this in the library.
Is there anyway to get a date in milliseconds since epoch?

@sdispater
Copy link
Collaborator

The DateTime.float_timestamp property gives you a timestamp with milliseconds precision (see https://pendulum.eustace.io/docs/#attributes-and-properties).

@jgrammen-agilitypr
Copy link
Author

that actually gives you the timestamp in microsecond precision, as of the posting of this comment the timestamp since epoch in miliseconds is

1529085780669

which has 13 digits.

the pendulum function in the example returns

>>> dt.float_timestamp
1346887571.123789

which has 16 digits (ignoring the period)

So guess the solution is to multiple by 1000 which gets me miliseconds and then drop everything after the decimal (the microsecond part).

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