Ordinal Date String to Standard Date String for a Beginner

Discussion in 'Ruby' started by davyb, Nov 18, 2005.

  1. davyb

    davyb Guest

    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
     
    davyb, Nov 18, 2005
    #1
    1. Advertising

  2. davyb

    Todd Guest

    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
     
    Todd, Nov 18, 2005
    #2
    1. Advertising

  3. davyb

    J. Merrill Guest

    Re: Ordinal Date String to Standard Date String for a Beginn

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


    --
    Posted via http://www.ruby-forum.com/.
     
    J. Merrill, Nov 18, 2005
    #3
  4. Re: Ordinal Date String to Standard Date String for a Beginn

    On 11/18/05, J. Merrill <> 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
    --
    Austin Ziegler *
    * Alternate:
     
    Austin Ziegler, Nov 18, 2005
    #4
  5. Re: Ordinal Date String to Standard Date String for a Beginn

    On 11/18/05, Austin Ziegler <> 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.
     
    Gregory Brown, Nov 18, 2005
    #5
  6. Re: Ordinal Date String to Standard Date String for a Beginn

    On 11/18/05, Gregory Brown <> 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
     
    Ryan Leavengood, Nov 18, 2005
    #6
  7. Re: Ordinal Date String to Standard Date String for a Beginn

    Ryan Leavengood <> wrote:
    > On 11/18/05, Gregory Brown <> 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
     
    Martin DeMello, Nov 18, 2005
    #7
  8. Re: Ordinal Date String to Standard Date String for a Beginn

    On 11/18/05, Martin DeMello <> 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.
     
    Gregory Brown, Nov 18, 2005
    #8
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. SamIAm
    Replies:
    1
    Views:
    1,519
    Andrew de la Harpe
    Sep 29, 2003
  2. Replies:
    4
    Views:
    2,183
  3. Ion Chalmers Freeman

    Re: Ordinal Expression from String

    Ion Chalmers Freeman, Jul 27, 2003, in forum: Java
    Replies:
    0
    Views:
    699
    Ion Chalmers Freeman
    Jul 27, 2003
  4. Chris Smith
    Replies:
    1
    Views:
    810
    Adam Maass
    May 16, 2005
  5. diegomrosa
    Replies:
    6
    Views:
    43,404
    Roedy Green
    Nov 19, 2005
Loading...

Share This Page