Results 1 to 4 of 4

Thread: date conversion

  1. #1

    date conversion

    good day!! i would like to ask if how to convert YYYY-MM-DD format to MM-DD-YYY and vice versa... thanks!!

  2. #2
    Quote Originally Posted by ivlem View Post
    good day!! i would like to ask if how to convert YYYY-MM-DD format to MM-DD-YYY and vice versa... thanks!!

    in what language? have you even tried google??

  3. #3
    icio's Avatar
    3,811
    posts
    looks better in lowercase
    Well I'm just going to assume that you're talking about PHP as it is the most commonly asked about.
    PHP Code:
    $old_date '1989-09-02'// YYYY-MM-DD
    $new_date preg_replace('/(\d\d\d\d)-(\d\d)-(\d\d)/''$2-$3-$1'$old_date);

    echo 
    $new_date
    Untested, but I hope that helps
    "60% of the time it works... every time." -- Paul Rudd as Brian Fantana.

  4. #4
    I used this a few times
    Code:
    $thisdate="2007-12-31";
    $flipped = date("m-d-Y", strtotime($thisdate));
    echo $flipped;
    Here is the date manual for php
    http://us3.php.net/date
    and the strtotime
    http://us3.php.net/manual/en/function.strtotime.php
    Web Site Design and Stuff....One day I will get it.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Home About kirupa.com Meet the Moderators Advertise

 Link to Us

 Credits

Copyright 1999 - 2012