#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    236
    Rep Power
    15

    Question mySQL/php date input and retrieve + dynamic date questions


    Hi,

    I want to have one attribute in my db which will be with date type. Now, what I need to know if the default format for that attribute is YYYY-M-D or YYYY-MM-DD so that I know if I should use
    PHP Code:
    date("Y-n-j"); 
    or
    PHP Code:
    date("Y-m-d"); 
    to get appropriate date format to be stored in db.

    also, can somebody please tell me how to generate date which will be one year from today's date, of course, in the mySQL acceptable format?

    thanks!
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jul 2001
    Location
    In a constant state of turmoil
    Posts
    855
    Rep Power
    86
    I think a look at the manuals is in order as these are questions easily answered there.

    PHP
    MySQL

    People here are happy to help you once they know you've tried to help yourself.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    236
    Rep Power
    15
    I read it, and as I saw it should be second option (YYYY-MM-DD), but regarding second question, I think that should be mktime(), although I am confused of how to generate date with it, so if somebody can write that piece of code which will increment current date with 365 days, or maybe better regarding february's date difference, I would appreciate that very much.

    thank you for your reply!
  6. #4
  7. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Oct 2003
    Posts
    236
    Rep Power
    15
    please, can somebody help me

IMN logo majestic logo threadwatch logo seochat tools logo