Results 1 to 2 of 2

Thread: Date/Time Display Issue

  1. #1
    Join Date
    Apr 2006
    Posts
    584
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Date/Time Display Issue

    Hi all,

    I log the date and time people log into my site, I was able to display this using this code
    Code:
    <?php echo $qry['loginDateTime']; ?>
    , but I wanted to change the way the date and time were displayed so I added this
    Code:
    <?php echo date('d/m/Y H:i:s', strtotime($qry['loginDateTime']));  ?>
    , that fixed the issue but now something wierd is happening. Not many members have logged in since I added the loginDateTime column in my db. So with the first code it just displayed nothing for members that haven't logged and that is fine. But with the new code if they haven't logged in it populates the field anyway with today's date and a time of 00:00:00... Any ideas as to why this is happening?

  2. #2
    Join Date
    Sep 2006
    Location
    St. George, UT
    Posts
    2,769
    Thanks
    3
    Thanked 157 Times in 155 Posts

    Default

    By default, the loginDateTime column (on your set up that is) inserts the datetime as 0000-00-00 00:00:00. This is why it is showing up as zeros. Try changing the data for those users by adding a fake login date to the loginDateTime column and see if that still shows zeros.

    Hope this helps.
    "Computer games don't affect kids; I mean if Pac-Man affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music." - Kristian Wilson, Nintendo, Inc, 1989
    TheUnlimitedHost | The Testing Site | Southern Utah Web Hosting and Design

Bookmarks

Posting Permissions

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