本文簡要介紹ruby語言中 Date.rfc2822
的用法。
用法
rfc2822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) → date
rfc822(string='Mon, 1 Jan -4712 00:00:00 +0000'[, start=Date::ITALY], limit: 128) → date
根據一些典型的 RFC 2822 格式從字符串解析創建一個新的 Date
對象。
Date.rfc2822('Sat, 3 Feb 2001 00:00:00 +0000')
#=> #<Date: 2001-02-03 ...>
當字符串長度超過 limit
時,引發 ArgumentError
。您可以通過傳遞 ‘limit: nil’ 來停止此檢查,但請注意,解析可能需要很長時間。
相關用法
- Ruby Date.rfc3339用法及代碼示例
- Ruby Date.rfc822用法及代碼示例
- Ruby Date.valid_civil?用法及代碼示例
- Ruby Date.gregorian?用法及代碼示例
- Ruby Date.strftime用法及代碼示例
- Ruby Date.valid_ordinal?用法及代碼示例
- Ruby Date.leap?用法及代碼示例
- Ruby Date.today用法及代碼示例
- Ruby Date.mday用法及代碼示例
- Ruby Date.next_year用法及代碼示例
- Ruby Date.day用法及代碼示例
- Ruby Date.d ===用法及代碼示例
- Ruby Date.strptime用法及代碼示例
- Ruby Date.to_s用法及代碼示例
- Ruby Date.parse用法及代碼示例
- Ruby Date.civil用法及代碼示例
- Ruby Date.cwyear用法及代碼示例
- Ruby Date.yday用法及代碼示例
- Ruby Date.d + other用法及代碼示例
- Ruby Date.julian?用法及代碼示例
- Ruby Date._parse用法及代碼示例
- Ruby Date.prev_year用法及代碼示例
- Ruby Date.jisx0301用法及代碼示例
- Ruby Date.new_start用法及代碼示例
- Ruby Date.amjd用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Date.rfc2822。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。