#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    14
    Rep Power
    0

    Fastest way to shorten month?


    I have a string that provides a weekend date as:

    March 1-3, 2013

    I want to shorten that to simply Mar 1-3, 2013 in a way that will work for any month/date combo like January 22-24, 2014.

    I can easily grab the first three characters and that will give me the month but how do I get rid of the rest of the characters up to the space? Or is there a better way to go about that?

    Thanks...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Expert (3500 - 3999 posts)

    Join Date
    Jul 2003
    Posts
    3,571
    Rep Power
    595
    PHP Code:
    $thedate=substr($mydate,0,3).substr($mydate,strpos($mydate," ")); 
    There are 10 kinds of people in the world. Those that understand binary and those that don't.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Mar 2013
    Posts
    14
    Rep Power
    0
    Thanks... Much appreciated.

IMN logo majestic logo threadwatch logo seochat tools logo