Ordinal Date String to Standard Date String for a Beginner

D

davyb

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
 
T

Todd

davyb said:
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
 
J

J. Merrill

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!!
 
A

Austin Ziegler

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
 
G

Gregory Brown

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.
 
R

Ryan Leavengood

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
 
M

Martin DeMello

Ryan Leavengood said:
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
 
G

Gregory Brown

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top