本文簡要介紹ruby語言中 Time.xmlschema
的用法。
用法
xmlschema(fraction_digits=0)
也別名為:iso8601
返回一個字符串,它將時間表示為由 XML Schema 定義的 dateTime:
CCYY-MM-DDThh:mm:ssTZD CCYY-MM-DDThh:mm:ss.sssTZD
其中 TZD 是 Z 或 [+-]hh:mm。
如果 self 是 UTC 時間,則 Z 用作 TZD。否則使用 [+-]hh:mm。
fractional_digits
指定用於小數秒的位數。它的默認值為 0。
require 'time'
t = Time.now
t.iso8601 # => "2011-10-05T22:26:12-04:00"
您必須要求 ‘time’ 才能使用此方法。
相關用法
- Ruby Time.xmlschema用法及代碼示例
- Ruby Time.gmtime用法及代碼示例
- Ruby Time.at用法及代碼示例
- Ruby Time.utc_offset用法及代碼示例
- Ruby Time.isdst用法及代碼示例
- Ruby Time.time + numeric用法及代碼示例
- Ruby Time.wednesday?用法及代碼示例
- Ruby Time.localtime用法及代碼示例
- Ruby Time.yday用法及代碼示例
- Ruby Time.time <=>用法及代碼示例
- Ruby Time.month用法及代碼示例
- Ruby Time.utc?用法及代碼示例
- Ruby Time.new用法及代碼示例
- Ruby Time.monday?用法及代碼示例
- Ruby Time.getutc用法及代碼示例
- Ruby Time.round用法及代碼示例
- Ruby Time.dst?用法及代碼示例
- Ruby Time.tv_nsec用法及代碼示例
- Ruby Time.gmt?用法及代碼示例
- Ruby Time.to_r用法及代碼示例
- Ruby Time.gmt_offset用法及代碼示例
- Ruby Time.ceil用法及代碼示例
- Ruby Time.parse用法及代碼示例
- Ruby Time.thursday?用法及代碼示例
- Ruby Time.floor用法及代碼示例
注:本文由純淨天空篩選整理自ruby-lang.org大神的英文原創作品 Time.xmlschema。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。