dateparse icon indicating copy to clipboard operation
dateparse copied to clipboard

Yet another crazy format

Open ferhatelmas opened this issue 6 years ago • 6 comments

A followup on #30 for excel.

43161.0: 2 March 2018
43186.0: 27 March 2018

ferhatelmas avatar Apr 03 '18 15:04 ferhatelmas

Is that 43161.0 a different column or part of the actual date format?

araddon avatar Apr 03 '18 17:04 araddon

Actual date format.

It should be how excel stores date internally: number of days (24h) passed since its start 1899-12-30 00:00:00 UTC.

ferhatelmas avatar Apr 03 '18 17:04 ferhatelmas

sorry been slow to do this one, just can't seem to come to grips with adding it to core lib, do you think its fair to say that this is reasonable/appropriate way to handle? If so i think I will close this.

dateStr := "43161.0: 2 March 2018"
parts := strings.Split(dateStr,": ")
t, err := dateparse.ParseAny(strings.TrimSpace(parts[1]))

araddon avatar May 04 '18 01:05 araddon

Sorry being not clear.

I wrote it like 43161.0: 2 March 2018 to signal result. The string I encountered is only 43161.0 so dateparse.ParseAny("43161.0") sounds reasonable to me.

ferhatelmas avatar May 04 '18 02:05 ferhatelmas

Any idea if the 43161.0 always has 1 digit after decimal place?

araddon avatar May 04 '18 03:05 araddon

Our data is working with dates so I have always seen with 1 digit but I guess technically it could be more to specify time.

ferhatelmas avatar May 04 '18 03:05 ferhatelmas