0

In excel the equivalent value to 43517 is 04-16-2019. The dataframe when it reads the value from the excel it reads it as an integer but I want to convert to timestamp.

df = df.selectExpr("cast(date as timestamp) date")

value = 43517 ; result = 1970-01-01 09:06:...

  • Does this answer your question? [convert Excel Date Serial Number to Regular Date](https://stackoverflow.com/questions/13850605/convert-excel-date-serial-number-to-regular-date) – mck Feb 18 '21 at 16:35

1 Answers1

0

the question is in no way related to Spark, it's just related to dates representation in the different 'systems'.

The point here is that one of the ways excel's dates are represented is in the form of number of days passed since 1/1/1900 while UNIX timestamp is the well known number of seconds from the epoch (1/1/1970)

you can check here the corresponding date of the value 43517 in terms of Timestamp https://www.epochconverter.com/timezones?q=43517&tz=UTC

I guess you should ask if there is a way to represent dates as timestamp in Excel or, in alternative, how to map values using Dataframes

NightHawk
  • 1
  • 1