1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

help on how to change dates and language

Discussion in 'PHP & Perl' started by administer, Mar 24, 2012.

  1. administer

    administer Registered Member

    Joined:
    Nov 19, 2008
    Messages:
    73
    Likes Received:
    1
    Hello,
    How are you doing?
    I'm desperate and need your help !
    I have set a jscript on my site:
    1. But the dates are in:
    month.day.Year
    and i'll like to have:
    day.month.Year
    2. Months are in english and i'd like them in german:
    January = Januar
    can you please help me with the code?
    Thank you again.

    Here's the code:
     
  2. tripper_john_md

    tripper_john_md Newbie

    Joined:
    Feb 21, 2011
    Messages:
    40
    Likes Received:
    35
    Location:
    Southern Germany
    Change
    PHP:
    $date="$_POST[dateyear]-$_POST[datemonth]-$_POST[dateday]";
    to
    PHP:
    $date="$_POST[dateday].$_POST[datemonth].$_POST[dateyear]";
    And change very occurence of
    PHP:
    date("F d, Y",
    to
    PHP:
    date("d.m.Y",
    Also change
    PHP:
    date("Y-m-d")
    to
    PHP:
    date("d.m.Y")
    wherever you find it.

    To use the german names of the months, change them there:
    PHP:
    $months=array('','January','February','March','April','May','June','July','August',
        
    'September','October','November','December');
    As last step change
    PHP:
    $parts=explode("-",$value);
        
        
    $day=$parts[2]+0;
        
    $month=$parts[1]+0;
        
    $year=$parts[0];
    to
    PHP:
    $parts=explode(".",$value);
        
        
    $day=$parts[0]+0;
        
    $month=$parts[1]+0;
        
    $year=$parts[2];
     
    • Thanks Thanks x 1
  3. administer

    administer Registered Member

    Joined:
    Nov 19, 2008
    Messages:
    73
    Likes Received:
    1
    Thank you for your help