Web Analytics Made Easy -
StatCounter convert function - CodingForum

Announcement

Collapse
No announcement yet.

convert function

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • convert function

    to all,
    i am trying to convert January-01-1980 to 01-01-80. is there a function to do this?

    pls advice.thanks
    Warm Regards,
    Mivec

  • #2
    Yes there is.
    You can replace the "-" and make a valid timestamp which you can then format as you like.

    PHP Code:
        $dateStr "January-01-1980";
    $timestamp strtotime(str_replace("-"" ",$dateStr));
    echo 
    date("d-m-y"$timestamp); 
    I don't know if you want to get a date with the day ot with the month at the first place. If you want the month at first place use this:

    PHP Code:
    echo date("m-d-y"$timestamp); 
    Saludo
    piz
    www.united-scripts.com
    www.codebattles.org

    Comment

    Working...
    X