Skip to content

Commit d62caee

Browse files
akzhanbcardiff
authored andcommittedMay 18, 2017
Documentation for HTTP.rfc1123_date. (#4418)
1 parent 3c1678e commit d62caee

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed
 

Diff for: ‎src/http/common.cr

+5
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,11 @@ module HTTP
224224
nil
225225
end
226226

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

0 commit comments

Comments
 (0)