Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Sep 2004
    Location
    USA
    Posts
    314
    Thanks
    7
    Thanked 0 Times in 0 Posts

    Converying old dates

    I have a system that grabs dates from a mysql database ranging from a few days ago. They come out in the format yyyy-mm-dd, is there any way to convert this to something more usefull like, Saterday, May 30th. I looked at some other posts, but they all seem to be relating to today rather than old dates.

    Thanks

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Location
    West Midlands, UK
    Posts
    623
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You could try strtotime() to convert your date into a timestamp then use date to change it into a nicely formatted date. For instance (in the following example, $data should contain your db date value):
    PHP Code:
    $data "2005-06-13";
    $formatted date('l \t\h\e jS \o\f F, Y'strtotime($data));
    echo 
    $formatted
    Generally it's more useful to store the unix timestamp if you have the option, rather than a pre-formatted date, since it's easier to manipulate, but hopefully the above will do what you want

  • #3
    Regular Coder
    Join Date
    Sep 2004
    Location
    USA
    Posts
    314
    Thanks
    7
    Thanked 0 Times in 0 Posts
    You are a genious! Works great, thanks so much.


  •  

    Posting Permissions

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