Skip to content

timestamp with miliseconds #222

Closed
Closed

Description

@jgrammen-agilitypr

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?

Activity

  1. sdispater commented on Jun 15, 2018

    @sdispater
    Collaborator

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

  2. jgrammen-agilitypr commented on Jun 15, 2018

    @jgrammen-agilitypr
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions