Hi,
I forwarded your questions to the author.
In message "Re: DateTime questions [newbie]"
on Sun, 23 Jan 2005 10:03:51 +0900, Navindra Umanee <navindra / cs.mcgill.ca> writes:
|I have some newbie questions.
|
|> DateTime.strptime('2000-09-28 05:23:01 -0400', '%F %T %z').strftime('%s')
|=> "970132981"
|
|> DateTime.strptime('970132981', '%s').strftime('%s')
|ArgumentError: invalid date
| from /usr/lib/ruby/1.8/date.rb:485:in `new_with_hash'
| from /usr/lib/ruby/1.8/date.rb:495:in `strptime'
| from (irb):31
|
|Why does the first command work but not the second one?
strptime does not support "%s". It supports year, month, date, hour,
minute, second, and timezone.
|Out of curiosity is there a standard/builtin way of printing ISO8601
|date format instead of having to use to_yaml and chopping off the "---
|" garbage string at the beginning of the input or having to manually
|specify '%F %T %z'?
How about DateTime#to_s?
|Also, is there a way of printing fractional seconds? I see that
|DateTime has sec_fraction() but '%N' doesn't seem to work in the
|string definition.
The author did not know about the "%N". Is it defined in any standard
(or on any platform)?
matz.