Extracting day and month from a date string in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • prashanth23in
    New Member
    • May 2007
    • 1

    Extracting day and month from a date string in PHP

    This is my first page

    [code=html]
    <form name="form1" method="post" action="ins_com p.php" onsubmit="retur n form_chk();">
    [/code]

    [Please use CODE tags when posting source code. Thanks! --pbmods]

    this is next page where i'm printing the posted values

    [code=php]
    echo '<pre>';
    print_r($_POST) ;
    [/code]

    its displaying


    Code:
    Array
    (
        [sys_id] => Dbms0001
        [domain] => Discnet
        [User] => prashanth
        [emp_code] => Dt0125
        [os] => WINDOWS XP
        [ip_addr] => 192.168.10.31
        [date_ins] => 24-05-2007
        [months] => 4
        [years] => 2007
    )
    the thing i do want to print months and years ... please help anyone....
    Last edited by pbmods; May 24 '07, 04:33 AM. Reason: Added code tags.
  • pbmods
    Recognized Expert Expert
    • Apr 2007
    • 5821

    #2
    Changed thread title to better match contents.

    ---------------

    Heya, prashanth23in. Welcome to TSDN!

    Take a look at the date and strtotime functions. They should do just about exactly what you're looking for.

    Comment

    Working...