Results 1 to 3 of 3

Thread: Dates in YYYYMMDDHHMMSS

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Posts
    148

    Dates in YYYYMMDDHHMMSS

    Hi,

    I'm storing dates like "YYYYMMDDHHMMSS" so they can be numericaly sorted.

    I'm wondering how i could get the day of the week and suffix (th, nd, etc) from an integer in that format.

    I've searched the php website a few times but havent had any luck with this so please dont point me over to links on their site.

    One thing I did see referenaced many times were unix timestamps and php timestamps, but in no place does it explain what the format of them are! (Which is partly why the php website hasnt been any help)


    Thanks in advance

  2. #2
    PowerPoster
    Join Date
    Jul 1999
    Posts
    5,923
    unix timestamps are just the number of seconds since Jan 1st 1970 which explains why they are quite a few numbers long

    Just use the PHP function strtotime() on the stored value

    PHP Code:
    <?php

    $date 
    '2002-08-29 00:07';

    echo 
    date('l dS F'strtotime($date));

    ?>

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Sep 2001
    Posts
    148
    echo date('l dS F', strtotime(substr($tmpdate,0,8))); worked, thanks.

Posting Permissions

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



Click Here to Expand Forum to Full Width