get the week day of a date?

Discussion in 'Perl Misc' started by robertchen117@gmail.com, Mar 6, 2007.

  1. Guest

    my date format is "030207", 03/02/2007, how could I get it is Friday?

    Thanks, too tricky for me and beyond my mind.
     
    , Mar 6, 2007
    #1
    1. Advertising

  2. Mumia W. Guest

    On 03/05/2007 11:30 PM, wrote:
    > my date format is "030207", 03/02/2007, how could I get it is Friday?
    >
    > Thanks, too tricky for me and beyond my mind.
    >


    You can use the strftime function from the POSIX module.
     
    Mumia W., Mar 6, 2007
    #2
    1. Advertising

  3. Mumia W. Guest

    On 03/06/2007 01:17 AM, Mumia W. wrote:
    > On 03/05/2007 11:30 PM, wrote:
    >> my date format is "030207", 03/02/2007, how could I get it is Friday?
    >>
    >> Thanks, too tricky for me and beyond my mind.
    >>

    >
    > You can use the strftime function from the POSIX module.
    >
    >


    Here's a short example:

    require POSIX;
    import POSIX qw(strftime);

    my $string = '030207';
    my @date = $string =~ /../g;
    $date[2] += 100;
    $date[0] -= 1;

    print strftime('%F (%A)',0,0,0,@date[1,0,2]), "\n";
     
    Mumia W., Mar 6, 2007
    #3
    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. Guest
    Replies:
    3
    Views:
    1,844
    Alexandre
    Dec 22, 2003
  2. Kiran
    Replies:
    3
    Views:
    76,939
    Juan T. Llibre
    Jun 20, 2005
  3. Lew
    Replies:
    0
    Views:
    364
  4. Guest
    Replies:
    3
    Views:
    526
    Alexandre
    Dec 22, 2003
  5. Guest
    Replies:
    3
    Views:
    1,094
    Alexandre
    Dec 22, 2003
Loading...

Share This Page