Ordinal Date String to Standard Date String for a Beginner


#1

Hi,

I have an ordinal date string and I want to change it to an ordinary
date string. For example: 2005/1 should give January 1, 2005. I see
ordinal in the Date class but I need a simple example. Thanks,

Dave


#2

davyb wrote:

Hi,

I have an ordinal date string and I want to change it to an ordinary
date string. For example: 2005/1 should give January 1, 2005. I see
ordinal in the Date class but I need a simple example. Thanks,

Dave

irb(main):001:0> require ‘date’
irb(main):002:0> d = Date.( 2005, 321)
irb(main):003:0> d.to_s
=> ‘2005-11-17’
irb(main):004:0> d.asctime
=> “Thu Nov 17 00:00:00 2005”
irb(main):005:0> p “#{d.month}/#{d.day}/#{d.year}”
=> “11/17/2005”

There may be other methods/ways/formats, but those are what caught my
attention at first.

Todd


#3

Somewhat off-topic, but I notice that neither of you have registered.

If you register, when you return to the site the display shows you which
threads include messages that you haven’t yet read; and if you go back
to a thread that you’ve read partially, the display moves directly to
the first message you’ve not yet seen (but of course you can scroll up
if you need more context).

Registration is extremely painless and the rewards are significant!!


#4

On 11/18/05, J. Merrill removed_email_address@domain.invalid wrote:

Somewhat off-topic, but I notice that neither of you have registered.

Actually, it’s extremely off-topic, as most of us do not read
ruby-talk through the ruby-forum interface, but rather through the
mailing list or the newsgroup.

-austin


#5

On 11/18/05, Gregory B. removed_email_address@domain.invalid wrote:

I am not against advocating ruby-forum, I just don’t see why every
message needs to be tagged with that message.

I strongly agree. I would recommend removing the tagline and adding a
new header to indicate the message was posted from Ruby Forum. That
way if someone or something (aka a program) wishes to analyze messages
from Ruby Forum, they can easily and reliably see which messages are
from the forum.

Maybe:

X-Posted-Via: Ruby Forum

Ryan


#6

Ryan L. removed_email_address@domain.invalid wrote:

On 11/18/05, Gregory B. removed_email_address@domain.invalid wrote:

I am not against advocating ruby-forum, I just don’t see why every
message needs to be tagged with that message.

I strongly agree. I would recommend removing the tagline and adding a
new header to indicate the message was posted from Ruby Forum. That
way if someone or something (aka a program) wishes to analyze messages
from Ruby Forum, they can easily and reliably see which messages are
from the forum.

OTOH there’s something to be said for leaving it in place at least a
couple of months - it’s fairly inoffensive and provides some visibility
for the fledgling forum interface.

martin


#7

On 11/18/05, Austin Z. removed_email_address@domain.invalid wrote:

Actually, it’s extremely off-topic, as most of us do not read
ruby-talk through the ruby-forum interface, but rather through the
mailing list or the newsgroup.

I think the ruby-forum is neat but as a minor whine, I don’t see why
all the posts from ruby-forum need to be stamped with a “Posted
via…” message.

This gets kinda SPAMmy, in my not at all humble opinion.

I am not against advocating ruby-forum, I just don’t see why every
message needs to be tagged with that message.


#8

On 11/18/05, Martin DeMello removed_email_address@domain.invalid wrote:

OTOH there’s something to be said for leaving it in place at least a
couple of months - it’s fairly inoffensive and provides some visibility
for the fledgling forum interface.

At the very least it should be an option for registered users to turn on
or off.
It reminds me way too much of “Do you yahoo?”

Besides, if it’s useful (which i think it is), there are plenty of
other places to evangelize it and word of mouth will spread as well.