1
votes

I am using .NET API provided by Mircosoft to get the file info stored in data lake store in my code. These files are generated by usqljob job. when i am using the following statement:

m_adlsFileSystemClient.FileSystem.GetFileStatus(m_adlsAccountName,fileName).FileStatus.ModificationTime

then it gives me the number ticks since epoch which is a long type value. Same thing happens when i try to get the expiration time of a file:

m_adlsFileSystemClient.FileSystem.GetFileStatus(m_adlsAccountName,fileName).FileStatus.ExpirationTime.

How can i get the date time type value for both expiration time and modification? I know i can add those ticks to a datetime type value. But which datetime should i add it to?

Thanks in Advance

1
Epoch is Jan 1 1970.Gaurav Mantri
Are you sure? where did you find it? Can you please share the link?Jai
No, the datetime 1, January 1970 isn't working for me. It should be different for data lake store files. Can anyone suggest me?Jai
Can you share what value is returned by data lake and what value should it correspond to in date/time. We could simply reverse engineer and figure out.Gaurav Mantri

1 Answers

0
votes

This is what I tried and working fine for me:

DateTime epoch = new DateTime(1970, 01, 01, 00, 00, 00, DateTimeKind.Utc);
int ticks = m_adlsFileSystemClient.FileSystem.GetFileStatus(m_adlsAccountName, file).FileStatus.ModificationTime;

The above line will return modification time in the form of ticks since the epoch.

modificationTime = epoch.AddMilliseconds(ticks );
int ticks = m_adlsFileSystemClient.FileSystem.GetFileStatus(m_adlsAccountName, file).FileStatus.ModificationTime;
expirationTime = epoch.AddMilliseconds( ticks);

It gave me the correct results.