Having this 12 byte array (int96) to timestamp.
[128 76 69 116 64 7 0 0 48 131 37 0]
How do I cast it to timestamp?
I understand the first 8 byte sho
@Zoltan you definitely deserve the vote although you didn't supply a Golang sulotion.
Thanks to you and to https://github.com/carlosjhr64/jd
I wrote a function func int96ToJulian(parquetDate []byte) time.Time
playground
func int96ToJulian(parquetDate []byte) time.Time {
nano := binary.LittleEndian.Uint64(parquetDate[:8])
dt := binary.LittleEndian.Uint32(parquetDate[8:])
l := dt + 68569
n := 4 * l / 146097
l = l - (146097*n+3)/4
i := 4000 * (l + 1) / 1461001
l = l - 1461*i/4 + 31
j := 80 * l / 2447
k := l - 2447*j/80
l = j / 11
j = j + 2 - 12*l
i = 100*(n-49) + i + l
tm := time.Date(int(i), time.Month(j), int(k), 0, 0, 0, 0, time.UTC)
return tm.Add(time.Duration(nano))
}