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 4 of 4
  1. #1
    New Coder
    Join Date
    Mar 2011
    Posts
    33
    Thanks
    9
    Thanked 0 Times in 0 Posts

    how to customise how the date is shown?

    Hi, how do i change how the date is displayed?

    currently a when i post news on my cms along with the article it auto posts a date and time of post.

    Now when i output the date its shown as:
    2011-05-26 09:51:44

    is it possible to edit how the date is shown?

    This is how i grap the data:
    PHP Code:
        <?php
        
    while ($row mysql_fetch_assoc($getnews))
        {
        
    $date $row['date'];
    ?>
    and output:

    PHP Code:
    <?php echo $date ?>

  • #2

  • Users who have thanked gvre for this post:

    TurkzZ (05-26-2011)

  • #3
    Senior Coder kbluhm's Avatar
    Join Date
    Apr 2007
    Location
    Philadelphia, PA, USA
    Posts
    1,509
    Thanks
    3
    Thanked 258 Times in 254 Posts
    Have a look at:
    http://www.php.net/date
    http://www.php.net/strtotime

    PHP Code:
    $date '2011-05-26 09:51:44';

    echo 
    date'F jS, Y'strtotime$date ) ); // May 26th, 2011 

  • Users who have thanked kbluhm for this post:

    TurkzZ (05-26-2011)

  • #4
    New Coder
    Join Date
    Mar 2011
    Posts
    33
    Thanks
    9
    Thanked 0 Times in 0 Posts
    thanks guys, big help there, i saw that php page, had issues in getting the actual date from the DB, instead was posting the date now instead lol, sorted now cheers again


  •  

    Posting Permissions

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