Date Format for lastModified

Tags
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()

Best Answer

  • 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

  • Neuron 2020, Neuron, Registered, Dataiku Frontrunner Awards 2021 Finalist, Neuron 2021, Neuron 2022, Dataiku Frontrunner Awards 2021 Participant, Neuron 2023 Posts: 330 Neuron
    edited July 2024

    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

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

    Hi Marlan,

    Got it, Thanks for the below solution.

Welcome!

It looks like you're new here. Sign in or register to get started.

Welcome!

It looks like you're new here. Sign in or register to get started.