SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    who wrote this??? DATE_FORMAT($date)

    hi guys..

    I'm wondering who wrote this function... it was in one post some time back. I just need clarification on calling this function... as in what to put in date_format() upon calling it....

    here's the code:

    <? //TESTING DATE CHANGER

    function date_format($date) {
    $array = split("-", $date);
    $array[1] = ($array[1] != 10) ? str_replace("0", "", $array[1]) : $array[1];
    $array[2] = (($array[2] != 10) && ($array[2] != 20) && ($array[2] != 30)) ? str_replace("0", "", $array[2]) : $array[2];
    $date = "$array[1]-$array[2]-$array[0]";
    return $date;
    }


    Any ideas? I didn't manage to get it to work in the first place....

  2. #2
    SitePoint Enthusiast Ckeren's Avatar
    Join Date
    Jun 2001
    Location
    AU
    Posts
    98
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could find who wrote it from the provided search tool, good luck!

  3. #3
    SitePoint Addict
    Join Date
    Jun 2001
    Location
    Malaysia
    Posts
    352
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    aha!! the search function.. of course.. *slaps forehead*

    found it.. thanks Ckeren.. had to vary my search criteria a few times but i got it..

  4. #4
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I wrote it. It's simple, I know. Anyway, it's made for use with MySQL's CURDATE() function...which returns the day in this format:

    yyyy-mm-dd

    Edit: You'll want to change split() to explode() -- mildly more efficient. Man, I wonder if I posted that code long ago? I havn't use split() in the longest time.
    Last edited by TWTCommish; Jul 11, 2001 at 06:00.

  5. #5
    Dumb PHP codin' cat
    Join Date
    Aug 2000
    Location
    San Diego, CA
    Posts
    5,460
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Doh! Chris you posted it in the Handy Dandy functions thread. Have a look at the one right below chris'
    Please don't PM me with questions.
    Use the forums, that is what they are here for.

  6. #6
    SitePoint Wizard TWTCommish's Avatar
    Join Date
    Aug 1999
    Location
    Pittsburgh, PA, USA
    Posts
    3,910
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    My bad! I've fixed it.

  7. #7
    You want what? By when?? Milamber's Avatar
    Join Date
    Jan 2001
    Location
    California
    Posts
    342
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Originally posted by freddydoesphp
    Doh! Chris you posted it in the Handy Dandy functions thread. Have a look at the one right below chris'

    Hehehehe!


    some one talking about my thread! I feel so neat now
    -Jeff Minard | jrm.cc - Battlefield 2 Stats


Bookmarks

Posting Permissions

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