DEV Community

Discussion on: I Wrote Go-TinyDate, The Missing Golang Date Package

Collapse
 
tudorhulban profile image
Tudor Hulban

What would be the advantage over using a struct with just UNIX time?

Collapse
 
wagslane profile image
Lane Wagner

Check out this new package! github.com/lane-c-wagner/go-tinytime

Collapse
 
wagslane profile image
Lane Wagner • Edited

That's a good point - For the same memory (uint32) you could get second precision, but you give up being able to represent quite as many dates.

Edit: Also, using day, month, year supports from year 0 to year 65535. Unix time supports from 1970 to ~2100

Maybe I'll make a go-tinytime package that does what you suggest. It essentially gets second precision at the cost of fewer date options.