`import "github.com/cactus/gostrftime"`

Package gostrftime formats time.Time using strftime(3) conventions.

Format returns a textual representation of the time value formatting according to format. format supports most of the formatting methods defined in strftime(3), minus the GNU libc extensions and POSIX locale extensions.

List of accepted format expansion values:

%A full weekday name (Sunday) %a abbreviated weekday name (Sun) %B full month name (September) %b abbreviated month name (Sep) %C (year / 100) as number. Single digits are preceded by zero (20) %D equivalent to %m/%d/%y (09/21/14) %d day of month as number. Single digits are preceded by zero (21) %e day of month as number. Single digits are preceded by a blank (21) %f microsecond as a six digit decimal number, zero-padded on the left (001234) %F equivalent to %Y-%m-%d (2014-09-21) %H the hour (24 hour clock) as a number. Single digits are preceded by zero (15) %h same as %b %I the hour (12 hour clock) as a number. Single digits are preceded by zero (03) %j the day of the year as a decimal number. Single digits are preced by zeros (264) %k the hour (24 hour clock) as a number. Single digits are preceded by a blank (15) %L millisecond as a three digit decimal number, zero-padded on the left (001) %l the hour (12 hour clock) as a number. Single digits are preceded by blank ( 3) %M the minute as a decimal number. Single digits are preceded by a zero (32) %m the month as a decimal number. Single digits are preceded by a zero (09) %N nanosecond as a 9 digit decimal number, zero-padded on the left (001234567) %n a newline (\n) %P am or pm as appropriate %p AM or PM as appropriate %R equivalent to %H:%M %r equivalent to %I:%M:%S %p %S the second as a number. Single digits are preceded by a zero (05) %s the number of seconds since the Epoch, UTC %T equivalent to %H:%M:%S %t a tab (\t) %v equivalent to %e-%b-%Y %w the weekday (Sunday as first day of the week) as a number. (0) %Y the year with century as a number (2014) %y year without century as a number. Single digits are preceded by zero (14) %Z time zone name (UTC) %z the time zone offset from UTC (-0700)

Code:

t := time.Date(2009, time.November, 10, 23, 0, 0, 0, time.UTC) fmt.Println(gostrftime.Format("%Y-%m-%d", t))

Output:

2009-11-10

Strftime is an alias for Format

Package gostrftime imports 5 packages (graph) and is imported by 11 packages. Updated 2017-09-04. Refresh now. Tools for package owners.