SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: date functions

  1. #1
    SitePoint Member
    Join Date
    May 2003
    Location
    Creve Coeur, Il.
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    date functions

    First off I feel like a total idiot by asking this. I am missing something simple here I know it.

    I have a MySql database with some fields set as the type date/time for storing date/timestamps. When I look at the database with PhpMyAdmin it displays the date/Time as 0000-00-00 00:00:00. When I update a timestamp, I create the timestamp value by using date('Y-m-d H:m:s') which creates a date/time string that matches this format. After updating the database when I view it from phpMyAdmin it displays the date/time as I would expect to find.

    I am using these dates as part of some reports and I wish to strip the time portion and format the date in the following format by using
    date("m/d/Y",$Row[DateStamp]);

    I am getting some really odd dates back and am unsure why?

    what am I missing.
    Just lost, not hopeless yet.

  2. #2
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Why not make a varchar(20) db field and put time() values there ? Then your date convert function(s) would work alright. Most date convert functions are buggy when you supply a formatted date as parameter.
    Last edited by DarkAngelBGE; Sep 11, 2003 at 11:18.

  3. #3
    SitePoint Member
    Join Date
    May 2003
    Location
    Creve Coeur, Il.
    Posts
    17
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    After some testing and such, this does appear the be the best way. That is why I ask here. So many helpful people.
    Thanks a bunch.
    ineptitude = ineptitude - 1

  4. #4
    SitePoint Wizard
    Join Date
    May 2003
    Location
    Berlin, Germany
    Posts
    1,829
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hehe, make sure to ask everything you want to know. That's so great here with this community, there is always (well 99.9%) somebody who can help you.


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
  •