Class | Date |
In: |
sources/parser/string.rb
|
Parent: | ByteString |
REGEXP_TOKEN | = | "(D:)?(\\d{4})(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(\\d{2})?(?:([\\+-Z])(?:(\\d{2})')?(?:(\\d{2})')?)?" |
# File sources/parser/string.rb, line 309 309: def initialize(year, month = nil, day = nil, hour = nil, minute = nil, second = nil, ut_sign = nil, ut_hours = nil, ut_min = nil) 310: 311: year_str = '%04d' % year 312: month_str = month.nil? ? '01' : '%02d' % month 313: day_str = day.nil? ? '01' : '%02d' % day 314: hour_str = '%02d' % hour 315: minute_str = '%02d' % minute 316: second_str = '%02d' % second 317: 318: date_str = "D:#{year_str}#{month_str}#{day_str}#{hour_str}#{minute_str}#{second_str}" 319: date_str << "#{ut_sign}#{'%02d' % ut_hours}'#{'%02d' % ut_min}" unless ut_sign.nil? 320: 321: super(date_str) 322: end
Returns current Date String in UTC time.
# File sources/parser/string.rb, line 346 346: def self.now 347: now = Time.now.getutc 348: year = now.strftime("%Y").to_i 349: month = now.strftime("%m").to_i 350: day = now.strftime("%d").to_i 351: hour = now.strftime("%H").to_i 352: min = now.strftime("%M").to_i 353: sec = now.strftime("%S").to_i 354: 355: Origami::Date.new(year, month, day, hour, min, sec, 'Z', 0, 0) 356: end