Monday, December 10, 2012

strftime

Go's time.Time already have Format, which is very human readable. However if you try to "embed" time format in longer strings, Format might expand things that you want to stay fixed. Take for example "/report06/2006", the first "06: will be expanded to the current year.

Python's strftime is less human readable but requires explicit escaping to it's easier to write string with embedded time directives. Now you can have strftime in Go as well.

To get it, run the usual go get bitbucket.org/tebeka/strftime.

No comments:

Post a Comment

/* MIKI: Analytics */