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
    Senior Coder
    Join Date
    May 2006
    Posts
    1,683
    Thanks
    28
    Thanked 4 Times in 4 Posts

    Coverting timestamp to day date ?

    How do I convert my time stamp that is saved
    in my database as a number : "1235291592"
    back into a day and date
    eg Thursday, 12 March 2009.

    BTW did anything special happen at the magic time of
    "1234567890" ? I would have thought some geeks had a
    sort of new years eve party ?

    Thanks for any help on this

  • #2
    Senior Coder djm0219's Avatar
    Join Date
    Aug 2003
    Location
    Wake Forest, North Carolina
    Posts
    1,313
    Thanks
    4
    Thanked 207 Times in 204 Posts
    PHP Code:
    print date('l, j F Y','1235291592'); 
    Dave .... HostMonster for all of your hosting needs

  • #3
    Senior Coder
    Join Date
    May 2006
    Posts
    1,683
    Thanks
    28
    Thanked 4 Times in 4 Posts
    Thanks Dave,

    I tried that and I got this error:

    Warning: date() expects parameter 2 to be long, string given in /home/guru54gt5/public_html/new_members.php on line 57

    This is the code I used:
    PHP Code:
    while($row mysql_fetch_assoc($result)){
      
    extract($row);
      
    $join_dt date('l, j F Y','$create_date');      
      echo 
    "<div class=\"listerdiv\">
      <span class= \"lk\">$Rctr ) $user_id,  $contact, Join date: 
    $join_dt </span>

    The "create_date" field is defined in the table as:
    `create_date` int(12) default NULL,

    Have I done something wrong ?

  • #4
    Senior Coder CFMaBiSmAd's Avatar
    Join Date
    Oct 2006
    Location
    Denver, Colorado USA
    Posts
    3,151
    Thanks
    2
    Thanked 335 Times in 327 Posts
    Remove the single-quotes around the second parameter so it will be a number instead of a quoted string. And in fact, php variables are not parsed when inside single-quotes so, '$create_date' returns the string $create_date and not the value in that variable.
    If you are learning PHP, developing PHP code, or debugging PHP code, do yourself a favor and check your web server log for errors and/or turn on full PHP error reporting in php.ini or in a .htaccess file to get PHP to help you.


  •  

    Posting Permissions

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