Yukihiro Matsumoto <matz / ruby-lang.org> wrote: > I forwarded your questions to the author. Oh, wow, thanks matz... and thanks for Ruby too! :) > strptime does not support "%s". It supports year, month, date, hour, > minute, second, and timezone. I was looking at the code and __strptime in date/format.rb does have a case statement for %s... but I guess it is not fully implemented since new_with_hash does not know what to do with it. I now understand that Ruby's strptime is really based on the Unix strptime and that %s is a GNU extension: %s The number of seconds since the epoch, i.e., since 1970-01-01 00:00:00 UTC. Leap seconds are not counted unless leap second support is available. (from the strptime(3) manual) > |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? That does work... it's apparently what to_yaml uses as well. But I also found Time which is more interesting to me since it can work with Unix time and has other interesting methods (unfortunately yaml.rb uses DateTime, so I might have to find a way to convert back and forth between Time and DateTime). > The author did not know about the "%N". Is it defined in any standard > (or on any platform)? I am only looking at the GNU date(1) manual which says "%N" is nanoseconds... I now understand that Ruby's strftime/strptime are probably based on the Unix system calls of the same name which don't support "%N" either. I thought I might need it because the yaml.rb documentation uses fractional time in the date examples, but it doesn't seem necessary afterall. Thanks again! Cheers, Navin.