Results 1 to 6 of 6

Thread: PHP, MySQL, Dates... disaster

  1. #1
    Junior Member
    Join Date
    Aug 2005
    Location
    England
    Posts
    36

    PHP, MySQL, Dates... disaster

    Ok, I seen loooodes of threads on this elsewhere but no proper answer:

    In a MySQL table there is a date in the format of yyyy-mm-dd. I want to add 30 days onto that. It qould probably be done by PHP, or my a MySQL table. But remember you must take into account the amount of days in each month etc. Its a hard problem to solve and as far as I've seen PHP or SQL dosn't have any functions to do it directly. Has anyone got any help at all?

  2. #2
    Triple Platinum Member Curio's Avatar
    Join Date
    Nov 2004
    Location
    London
    Posts
    686
    I for one can't tell what you are asking. May be a reason why you have no replies. Are you saying the date was entered wrongly?
    I'm using Windows 7 - you got a problem with that?

  3. #3
    Nobody knows I'm a dog. TZ Veteran petard's Avatar
    Join Date
    Feb 2003
    Location
    Newspapastan
    Posts
    964
    Just add 30 days worth in seconds:
    30 days = 2, 592 ,000 seconds
    Theres a mySQL function to do that.

    Many thanks to egghead for the cool .sig

  4. #4
    Junior Member
    Join Date
    Aug 2005
    Location
    England
    Posts
    36
    oh right, I couldn't find anything like that when I looked before but ill have another search later

  5. #5
    Junior Member
    Join Date
    Sep 2006
    Posts
    9
    $newdate = mktime(0, 0, 0, date("m") , date("d")+30, date("Y")); could solve your problem.


  6. #6
    Junior Member GuitarCrazyo's Avatar
    Join Date
    Oct 2009
    Posts
    4

    PHP MySQL Dates disaster

    Hello jellewar
    Thanks a lot for this posting. Iam still looking for some IDE to learn PHP programming. May be phpDesigner is the right one to start with.
    HP

Posting Permissions

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