# Ordinal Date String to Standard Date String for a Beginner

**URL:** <https://www.ruby-forum.com/t/ordinal-date-string-to-standard-date-string-for-a-beginner/48247>\
**Category:** Ruby\
**Created:** [November 18, 2005, 4:44am UTC](https://www.ruby-forum.com/t/ordinal-date-string-to-standard-date-string-for-a-beginner/48247 "2005-11-18T04:44:09Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![david.a.boyd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ad7895/32.png) [@david.a.boyd](https://www.ruby-forum.com/u/david.a.boyd)\
**Post date:** [November 18, 2005, 4:44am UTC](https://www.ruby-forum.com/t/ordinal-date-string-to-standard-date-string-for-a-beginner/48247/1 "2005-11-18T04:44:09Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![david.a.boyd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ad7895/32.png) [@david.a.boyd](https://www.ruby-forum.com/u/david.a.boyd)\
**Post date:** [November 18, 2005, 6:29am UTC](https://www.ruby-forum.com/t/ordinal-date-string-to-standard-date-string-for-a-beginner/48247/2 "2005-11-18T06:29:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![david.a.boyd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ad7895/32.png) [@david.a.boyd](https://www.ruby-forum.com/u/david.a.boyd)\
**Post date:** [November 18, 2005, 5:50pm UTC](https://www.ruby-forum.com/t/ordinal-date-string-to-standard-date-string-for-a-beginner/48247/3 "2005-11-18T17:50:40Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![david.a.boyd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ad7895/32.png) [@david.a.boyd](https://www.ruby-forum.com/u/david.a.boyd)\
**Post date:** [November 18, 2005, 6:32pm UTC](https://www.ruby-forum.com/t/ordinal-date-string-to-standard-date-string-for-a-beginner/48247/4 "2005-11-18T18:32:00Z")

</div>

On 11/18/05, J. Merrill [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![david.a.boyd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ad7895/32.png) [@david.a.boyd](https://www.ruby-forum.com/u/david.a.boyd)\
**Post date:** [November 18, 2005, 8:41pm UTC](https://www.ruby-forum.com/t/ordinal-date-string-to-standard-date-string-for-a-beginner/48247/5 "2005-11-18T20:41:51Z")

</div>

On 11/18/05, Gregory B. [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![david.a.boyd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ad7895/32.png) [@david.a.boyd](https://www.ruby-forum.com/u/david.a.boyd)\
**Post date:** [November 18, 2005, 9:24pm UTC](https://www.ruby-forum.com/t/ordinal-date-string-to-standard-date-string-for-a-beginner/48247/6 "2005-11-18T21:24:08Z")

</div>

Ryan L. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On 11/18/05, Gregory B. [removed\_email\_address@domain.invalid](mailto: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

---

<div class="post-metadata">

**Author:** ![david.a.boyd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ad7895/32.png) [@david.a.boyd](https://www.ruby-forum.com/u/david.a.boyd)\
**Post date:** [November 18, 2005, 6:59pm UTC](https://www.ruby-forum.com/t/ordinal-date-string-to-standard-date-string-for-a-beginner/48247/7 "2005-11-18T18:59:11Z")

</div>

On 11/18/05, Austin Z. [removed\_email\_address@domain.invalid](mailto: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.

---

<div class="post-metadata">

**Author:** ![david.a.boyd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/ad7895/32.png) [@david.a.boyd](https://www.ruby-forum.com/u/david.a.boyd)\
**Post date:** [November 18, 2005, 9:57pm UTC](https://www.ruby-forum.com/t/ordinal-date-string-to-standard-date-string-for-a-beginner/48247/8 "2005-11-18T21:57:19Z")

</div>

On 11/18/05, Martin DeMello [removed\_email\_address@domain.invalid](mailto: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.
