Are there any String to DateTime conversion functions out there ?
Searched in RAA but did not get any … which kind of surprised me: surely,
I cannot be the first one to be asking for it
If no attempt is made in that direction yet, what would be the best starting
point for such an effort?
I am willing to devote some time and get it out there …
Hm, how about a static method in class Time, maybe Time.parse(pattern =
“”) with replaced by the ISO default pattern
(something like “YYYY.MM…”)?
Alternatively you could introduce a class TimeParser that is constructed
with a pattern and can create Time instances from given strings.
Maybe even a combination of both would be good: use TimeParser in the static
method and provide this class for more control, such as dailight saving
switch, a fixed offset to every parsed time etc.
What do others think?
robert
“Shashank Date” sdate@everestkc.net schrieb im Newsbeitrag
news:483e0ce751bc0580f1108dd59df946da@TeraNews…
Are there any String to DateTime conversion functions out there ?
Searched in RAA but did not get any … which kind of surprised me:
surely,
I cannot be the first one to be asking for it
If no attempt is made in that direction yet, what would be the best
starting
···
point for such an effort?
I am willing to devote some time and get it out there …
Hm, how about a static method in class Time, maybe
Time.parse(pattern =“”) with
replaced by the ISO default pattern (something like
“YYYY.MM…”)?
Yes, I will like to consider the ISO patterns even though
currently my “need of the day” does not require it to be.
Alternatively you could introduce a class TimeParser
that is constructed with a pattern and can create Time
instances from given strings.
I am looking at the ParseDate module that comes with the
standard distribution which can handle a subset of ISO-8601
formats among others. But it returns an array which I can
easily convert to a Time object.
On my WinXP Pro (ruby 1.6.8 (2002-12-24) [i586-mswin32]
something like:
···
On Friday, 2 May 2003 22:05:43 +0900, Robert wrote: