[#3006] CVS repository — "Eugene Scripnik" <hoaz@...>

Hello.

21 messages 2004/06/16
[#3008] Re: CVS repository — ts <decoux@...> 2004/06/16

>>>>> "E" == Eugene Scripnik <hoaz@gala.net> writes:

[#3009] Re: CVS repository — Michal Rokos <michal@...> 2004/06/16

Hi!

[#3057] Ruby 1.8.2 to be released. — matz@... (Yukihiro Matsumoto)

Hi,

20 messages 2004/06/23

Re: Date.from_time

From: Hugh Sasse Staff Elec Eng <hgs@...>
Date: 2004-06-14 09:22:42 UTC
List: ruby-core #2981
On Sun, 13 Jun 2004, Gavin Sinclair wrote:

> Folks,
>
> At the moment, I don't see an easy way to create a Date or DateTime
> object given a Time object.  That's something I need to do at the
> moment, and it seems like it should be easy.

I think it may be possible through strftime, strptime...

STRFTIME_FORMAT = "%a, %d %b %Y %H:%M:%S GMT"

EPOCH = Time.at(0).gmtime.strftime(STRFTIME_FORMAT)
def something(since=EPOCH)
  since_t = DateTime.strptime(since, STRFTIME_FORMAT)
  ...
end

(This is using the time format for HTTP/1.1, which seems to be RFC
1123).  I don't know what can be done about (milli|micro)second
accuracy.

>
> If I submit a patch to define Date.from_time, will it be accepted?  Is
> there a preferred name?
>
> Gavin
>
        Hugh


In This Thread