[LRUG] Ruby - ISO 8601

Tony Hammond t.hammond at nature.com
Wed May 17 03:28:40 PDT 2006


Thanks, James:

Had forgotten to do the 'require'.

Mind you, first time I tried this I got the following error:

% ruby openurl.rb ng
/usr/local/lib/ruby/1.8/date/format.rb:6: Date is not a class (TypeError)
        from /usr/local/lib/ruby/1.8/parsedate.rb:4
        from /usr/local/lib/ruby/1.8/time.rb:43
        from openurl.rb:82

With the following require statements:

require 'cgi'
require 'net/http'
require "rexml/document"; include REXML
require 'time'

If I shift the order and put "require 'time'" first, everything is then
hunky dory. Strange (?)

Cheers,

Tony


On 17/5/06 11:19, "James Adam" <james.adam at gmail.com> wrote:17/5/06 11:19

> FYI Tony,
> 
>   require 'time'
>   Time.now.iso8601
>   ==> "2006-05-17T11:19:04+01:00"
> 
> HTH,
> 
> James
> 
> On 5/17/06, Tony Hammond <t.hammond at nature.com> wrote:
>> 
>> Ouch:
>> 
>> Sorry, guys was just meant as an internal Q.
>> 
>> Cheers,
>> 
>> Tony
>> 
>> Ps/
>> B**** Outlook.
>> 
>> 
>> On 17/5/06 11:15, "Tony Hammond" <t.hammond at nature.com> wrote:17/5/06 11:15
>> 
>>> Tom:
>>> 
>>> Am being extremely dense this morning. How do I get an ISO 8601 datetime
>>> from
>>> a Ruby Time object?, e.g.
>>> 
>>> dt = Time.now
>>> 
>>> Then what?
>>> 
>>> Time.iso8601(dt)
>>> 
>>> Doesn't do it - not a defined class method.
>>> 
>>> There's something in standard lib time.rb but I'm not reading that right.
>>> 
>>> Any help - cheers,
>>> 
>>> Tony
>> 
>> *****************************************************************************
>> ***
>> DISCLAIMER: This e-mail is confidential and should not be used by anyone who
>> is
>> not the original intended recipient. If you have received this e-mail in
>> error
>> please inform the sender and delete it from your mailbox or any other storage
>> mechanism. Neither Macmillan Publishers Limited nor any of its agents accept
>> liability for any statements made which are clearly the sender's own and not
>> expressly made on behalf of Macmillan Publishers Limited or one of its
>> agents.
>> Please note that neither Macmillan Publishers Limited nor any of its agents
>> accept any responsibility for viruses that may be contained in this e-mail or
>> its attachments and it is your responsibility to scan the e-mail and
>> attachments (if any). No contracts may be concluded on behalf of Macmillan
>> Publishers Limited or its agents by means of e-mail communication. Macmillan
>> Publishers Limited Registered in England and Wales with registered number
>> 785998
>> Registered Office Brunel Road, Houndmills, Basingstoke RG21 6XS
>> *****************************************************************************
>> ***
>> _______________________________________________
>> chat mailing list
>> chat at lists.lrug.org
>> http://lists.lrug.org/listinfo.cgi/chat-lrug.org
>> 
> 



More information about the Chat mailing list