www.webdeveloper.com
Results 1 to 3 of 3

Thread: Change US dates to UK dates

  1. #1
    Join Date
    Jul 2008
    Posts
    4

    Change US dates to UK dates

    I have a problem, I haev been given a excel file with several hundred dates, but when I import it inot indesign the UK dates (day/month/year) change to (month/day/year). How can I write a php script that could change the dates around?

    all dates are formatted 12/3/2008. So you just would need to match the first two and change them around. Any ideas on how to do this?

  2. #2
    Join Date
    Jun 2006
    Location
    Down at the bottom of the garden
    Posts
    1,239
    PHP Code:
    $us_date '12/3/2008';

    list(
    $month$day$year) = explode('/'$us_date);
    $uk_date $day.'/'.$month.'/'.$year;

    echo 
    $uk_date
    Or..

    PHP Code:
    $us_date '12/3/2008';

    $uk_date preg_replace("/^([0-9]*?)\/([0-9]*?)\/([0-9]*?)$/""$2/$1/$3"$us_date)

    echo 
    $uk_date
    Last edited by MrCoder; 07-23-2008 at 11:21 AM.
    Quote Originally Posted by temp.user123
    You know... You're not so smart. Do you need me to educate you?
    If you say, "please," (and do so, nicely) then I will show you where you're dead wrong.

  3. #3
    Join Date
    Jul 2008
    Posts
    4
    Thank you

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
  •  
HTML5 Development Center



Recent Articles