How Do I Record "Today's Date + 30 Days" on a Database

Status
Not open for further replies.

Gugel

New member
Jul 9, 2007
22
0
0
All-wise and knowing WF, I need your help.

On a form, I have an option in a drop-down menu that reads "Flexible Date". When someone selects that option, I need it to record to the database (Coldfusion if its relevant) as Today's Date + 30 days. In other words, let's say today is Oct. 1st and the user select "Flexible Date". When they submit the form, it should be recorded in the database as Oct. 31st.

Any ideas on how this can be done? Thanks!
 


I don't know how it's stored in coldfusion. In MySQL I use either the current unix epoch+( 30*24*3600) which gives me the time 30 days in the future ( by adding that many seconds ) or I use dateadd( now(), "30 days" ).

I guess what I'm saying is that it depends on how it's stored in the db.
 
Not sure about Coldfusion, but this is how i do it in mySQL:

INSERT INTO foo (date) VALUES(DATE_ADD(NOW(), INTERVAL 30 DAY));
 
Not sure about Coldfusion, but this is how i do it in mySQL:

INSERT INTO foo (date) VALUES(DATE_ADD(NOW(), INTERVAL 30 DAY));



ColdFusion is almost the same...

Code:
<cfquery name="myQueryName" datasource="myDatasourceName">
   insert into myTable(myDate)
   values (#DateAdd("d", 30, Now())#)
</cfquery>
 
Status
Not open for further replies.