May 23, 2012, 09:23:17 AM
Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News
: follow us on twitter @dotdragnet
Home
Help
Search
Login
Register
DotDragnet
>
The Tech Side
>
Tech stuff
>
mysql date question
Pages: [
1
]
Go Down
« previous
next »
Print
Author
Topic: mysql date question (Read 1079 times)
Charisma Bypass
Hero Member
Posts: 556
mysql date question
«
on:
March 05, 2009, 11:40:44 AM »
I have to get a date, add 30 days to it and then insert that new date into a table...
Gettind the date is easy, it's the date of purchase: $order->info['date']
Adding 30 days, I thought to use the INTERVAL 30 DAY
So, my end code looks like;
("
insert into XYZ (code, amount, date) values ('123', '15', '" . $order->info['date'] . "'
");
The above works fine - it inserts the necessary details. I can't get the right syntax to add the 30 days onto the date. Date looks like this: 2009-02-12 22:05:01
Thank You in advance for any help.
Logged
sarahA
DDN Contribs
Hero Member
Posts: 2176
Re: mysql date question
«
Reply #1 on:
March 05, 2009, 12:08:26 PM »
Code:
insert into XYZ (code, amount, date) values ('123', '15', DATE_ADD('" .$order->info['date'] . "', INTERVAL 30 DAY)
should work
Logged
Stuff By Me
:
Photos
Charisma Bypass
Hero Member
Posts: 556
Re: mysql date question
«
Reply #2 on:
March 05, 2009, 01:39:10 PM »
Thanks Sarah, appreciate that
I ended up using;
'" . $order->info['date'] . "' + interval 30 day
Logged
Pages: [
1
]
Go Up
Print
« previous
next »
Jump to:
Please select a destination:
-----------------------------
General Category
-----------------------------
=> General Discussion
=> Jee's Forum of Appalling Jokes
-----------------------------
The Creative Side
-----------------------------
=> Arty stuff
=> Photography
=> On the web
-----------------------------
The Tech Side
-----------------------------
=> Tech stuff
=> Hardware & Software
-----------------------------
The Business Side
-----------------------------
=> Anything business related
-----------------------------
The Practical Side
-----------------------------
=> Practical Advice
DotDragnet
>
The Tech Side
>
Tech stuff
>
mysql date question
Loading...