Discover this year's submissions to the Dataiku Frontrunner Awards and give kudos to your favorite use cases and success stories!READ MORE

Date Format for lastModified

Solved!
sunith992
Level 2
Date Format for lastModified

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

0 Kudos
1 Solution
MiguelangelC
Dataiker
Dataiker

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

 

View solution in original post

3 Replies
MiguelangelC
Dataiker
Dataiker

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

 

Marlan
Neuron
Neuron

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
Level 2
Author

Hi Marlan,

Got it, Thanks for the below solution.

0 Kudos