How to print date from crtime?

Discussion in 'PHP' started by jfontestad, Nov 26, 2006.

  1. #1
    I have a script that organized data entries by the date submitted through the crtime function. How do I display the crtime. What would be the php code to display the date that the item was created ?

    Thanks.
     
    jfontestad, Nov 26, 2006 IP
  2. lbalance

    lbalance Peon

    Messages:
    381
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #2
    that sounds like it could be a custom function with the script and not a regular PHP function. you should dig through the code and find other examples of how they used crtime.
     
    lbalance, Nov 26, 2006 IP
  3. disgust

    disgust Guest

    Messages:
    2,417
    Likes Received:
    133
    Best Answers:
    0
    Trophy Points:
    0
    #3
    crtime is not a built in php function.

    if it's a custom function we'd need to know the code.

    that or just echo / vardump crtime and show us what the value is.
     
    disgust, Nov 26, 2006 IP
  4. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #4
    I noticed that it uses the .time(). to store the date added and when stored in the database it looks like this: 1164408499
    how would i make that a date like: 11/11/2006 ? or whatever date that may be.
     
    jfontestad, Nov 26, 2006 IP
  5. lbalance

    lbalance Peon

    Messages:
    381
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #5
    
    date("m/d/Y",time())
    
    PHP:
     
    lbalance, Nov 26, 2006 IP
  6. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #6
    how would i call that from a column?
    like would this work:
    $dateadded = date("m/d/Y",time($row['crtime']));
     
    jfontestad, Nov 26, 2006 IP
  7. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #7
    anyone?

    what would be the code to make the stored value appear as a date?
     
    jfontestad, Nov 27, 2006 IP
  8. lbalance

    lbalance Peon

    Messages:
    381
    Likes Received:
    18
    Best Answers:
    0
    Trophy Points:
    0
    #8
    if a timestamp is stored in $row['crtime'], then it would be:
    
    $dateadded = date("m/d/Y",$row['crtime']);
    
    PHP:
     
    lbalance, Nov 27, 2006 IP
    jfontestad likes this.
  9. jfontestad

    jfontestad Well-Known Member

    Messages:
    1,236
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    148
    #9
    thanks for the help.
     
    jfontestad, Nov 27, 2006 IP