Skip to content

Commit

Permalink
Documentation for HTTP.rfc1123_date. (#4418)
Browse files Browse the repository at this point in the history
  • Loading branch information
akzhan authored and bcardiff committed May 18, 2017
1 parent 3c1678e commit d62caee
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/http/common.cr
Expand Up @@ -224,6 +224,11 @@ module HTTP
nil
end

# Format a Time object as a String using the format specified by [RFC 1123](https://tools.ietf.org/html/rfc1123#page-55).
#
# ```
# HTTP.rfc1123_date(Time.new(2016, 2, 15)) # => "Sun, 14 Feb 2016 21:00:00 GMT"
# ```
def self.rfc1123_date(time : Time) : String
# TODO: GMT should come from the Time classes instead
time.to_utc.to_s("%a, %d %b %Y %H:%M:%S GMT")
Expand Down

0 comments on commit d62caee

Please sign in to comment.