#1
  1. No Profile Picture
    Junior Member
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2000
    Posts
    0
    Rep Power
    0
    I've been trying to store an form inputted date into a database and then retreive it, but it doesn't come out the same when I pull it out of the database. I have noted that MySQL has date column types which store dates in reverse sequence to the mktime() function in php, so I tried using a MEDIUMINT column for storing the date. Do I need to reverse the order of the date and then store it in one of the DATE type columns in MySQL or what? This is puzzling me.
  2. #2
  3. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    Well, naturally you have several options:

    1st - If you want to use mktime() you can always store your unix datestamp (what's generated via mktime() into a varchar field)

    2nd - Instead of mktime() you would probably want to use the "date()" function to store the date in the mySQL format.

    But, as I understand that date fields of mysql are automatic.. not sure really, I tend to use the 1st method.

  4. #3
  5. No Profile Picture
    Robert_J_Sherman
    Guest
    Devshed Newbie (0 - 499 posts)
    <BLOCKQUOTE><font size="1" face="Verdana,Arial,Helvetica">quote:</font><HR>Originally posted by Robert_J_Sherman:
    Well, naturally you have several options:

    1st - If you want to use mktime() you can always store your unix datestamp (what's generated via mktime() into a varchar field)

    2nd - Instead of mktime() you would probably want to use the "date()" function to store the date in the mySQL format.

    But, as I understand that date fields of mysql are automatic.. not sure really, I tend to use the 1st method.

    If you use the date() function, you'll want to pull your date according to the date function of mysql, like yyyy-mm-dd hh:mm:ss

    the php date() function can create your date stamp like this..

    reversing the order isn't too dificult either, you have a variety of method to accomplish this, mysql can do it..

    [/quote]



    ------------------
    SnR Graphics,
    Low Cost Hosting and Web Development.

Similar Threads

  1. [mysql 4.1.1] problems with storing utf8 data
    By Eelco in forum MySQL Help
    Replies: 3
    Last Post: January 8th, 2004, 01:19 PM
  2. Date storing and retreiving
    By Marky_Mark in forum PHP Development
    Replies: 35
    Last Post: October 11th, 2001, 11:30 AM

IMN logo majestic logo threadwatch logo seochat tools logo