Date Format for lastModified

sunith992
sunith992 Dataiku DSS Core Designer, Registered Posts: 20 ✭✭✭✭

Hi,

can anyone please help on the below output date format for lastModified metric, as i am seeing the value is too large and wondering what would the format would be here? , output = 1658217052750

dataiku.Dataset("*", project_key='*', ignore_flow=False).get_files_info()

Tagged:

Best Answer

  • Miguel Angel
    Miguel Angel Dataiker, Dataiku DSS Core Designer, Dataiku DSS ML Practitioner, Dataiku DSS Adv Designer, Registered Posts: 118 Dataiker
    Answer ✓

    Hi Sunith,

    That UNIX epoch timestamp is in milliseconds.

    If converted to a timestamp this file was last modified on: GMT: Tuesday, 19 July 2022 07:50:52.750

Answers

  • Marlan
    Marlan Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Dataiku Frontrunner Awards 2021 Participant, Neuron 2023 Posts: 321 Neuron
    edited July 17

    Hi @sunith992
    , to add to @MiguelangelC
    's response, here is how I convert unix epoch times to local time:

    import dataiku
    import datetime
    ds_last_modified_unix_epoch = dataiku.Dataset("DS_NAME").get_config()['versionTag']['lastModifiedOn']
    dtm = datetime.datetime.fromtimestamp(ds_last_modified_unix_epoch / 1000)
    print(dtm.strftime('%Y-%m-%d %H:%M:%S.%f'))

    To return UTC / GMT time, use utcfromtimestamp instead of fromtimestamp.

    Marlan

  • sunith992
    sunith992 Dataiku DSS Core Designer, Registered Posts: 20 ✭✭✭✭

    Hi Marlan,

    Got it, Thanks for the below solution.

Setup Info
    Tags
      Help me…