(perl6) DateTime::Format::LikeGo - format dates using Go's reference format
Perl 6
Switch branches/tags
Nothing to show
Latest commit aa00e70 Apr 25, 2017 @zoffixznet zoffixznet committed with Use modern META filename
The `META.info` is a legacy, pre-Christmas name. While it's still currently supported,
`META6.json` is the new name. And since a lot of people simply copy some module's 
structure, the old name still proliferates, so we're trying to get rid of it for good 
by sending PRs to any modules that use the old name, to switch to the modern name.
Failed to load latest commit information.
lib/DateTime/Format Add unit declarator to module declarations May 21, 2015
t Main implementation Jan 28, 2015
.travis.yml Add Travis-CI configuration Nov 12, 2016
META6.json Use modern META filename Apr 29, 2017
README.md (needless profanity)-- Aug 16, 2016



DateTime::Format::LikeGo - format dates using Go's reference format


use DateTime::Format::LikeGo;

# Format a date
say go-date-format("2006-01-02", DateTime.now);

# convert to strftime format:
say DateTime::Format::LikeGo::go-to-strftime("2006-01-02"); # %Y-%m-%d


A simple module that converts from Golang's "reference time" format to strftime. The intention is for you to specify how a certain datetime would be formatted, and it then can format any date in that style.

The reference date is 2006-01-02T15:04:05-0700, which is written as a series of ascending digits, if rearranged, and 3pm is used instead of 15.

Inspired by complaints about the Go time format.


go-date-format(Str $format, DateTime $date) is export returns Str

Format the given time according to the provided format string.

go-to-strftime(Str $format) returns Str

Return the strftime version of the go format.


A string exception is thrown if the converted strftime format has any digits left over, which typically indicate a bad input format.


  • Timezone support is missing in DateTime::Format, so strings using timezones will fail until it is added.
  • Not well tested overall.


  • Rakudo Perl 6 2014.11 or above. Tested primarily on MoarVM.
  • DateTime::Format


http://flippinggodateformat.com/ - inspiration for this module

Documentation for Go's time package