From: Navindra Umanee Date: 2005-01-23T10:03:51+09:00 Subject: DateTime questions [newbie] Hi! 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? 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'? 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. Thanks a lot! Cheers, Navin.