close ad
Help us test the new Databridge BETA with MySQLi support
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

add 1 year to current date

Thread began 2/20/2012 11:37 am by paul377172 | Last modified 2/22/2012 3:44 pm by Jason Byrnes | 764 views | 8 replies |

paul377172

add 1 year to current date

Hi, using the update record wizard what is the correct value i would enter into the date column when I want to update the current date by adding one year.

I have used this to add one year to the now date
<?php echo (date("Y-m-d h:n:s", strtotime("+1 year"))); ?>
thank you

Sign in to reply to this post

gary.brett434358

Originally Said By: paul377172
  Hi, using the update record wizard what is the correct value i would enter into the date column when I want to update the current date by adding one year.

I have used this to add one year to the now date
<?php echo (date("Y-m-d h:n:s", strtotime("+1 year"))); ?>
thank you  



Hi Paul, did you get this sorted? I have done this via sql recordset before but not in php?

In recordset try

tblPaulDateColumn,DATE_ADD(tblPaulDateColumn, INTERVAL 1 YEAR) AS FieldAliasName,



Cheers

Gary

Sign in to reply to this post

Jason ByrnesWebAssist

entering the code you provided:
<?php echo (date("Y-m-d h:n:s", strtotime("+1 year"))); ?>


as the value for4 the data column in the insert record behavior do what you are asking.

Sign in to reply to this post

paul377172

yes I managed to do it like you said Gary. Sorry not sure what you mean by your last sentance Jason.
The php code i entered into the update record behaviour date column is
<?php echo $row_Recordset2['DATE_ADD(renewal_date,INTERVAL 1 YEAR)']; ?>
which does indeed uodate the date by 1 year
thanks

Sign in to reply to this post

Jason ByrnesWebAssist

in the insert record behavior, select the data column and use the code you provided:
<?php echo (date("Y-m-d h:n:s", strtotime("+1 year"))); ?>

as the value

Sign in to reply to this post

paul377172

sorry if i am misunderstanding but i want to update a current record by adding 1 year to the current value, not add a new one.

Sign in to reply to this post

Jason ByrnesWebAssist

My apologies, it was me who misunderstood. I missed the important word "update"....


on your update page, add a hidden form element. set the value of the hidden element to:

php:
<?php echo (date("Y-m-d h:n:s"strtotime($row_recordsetName['DateColumn'],'+1 year'))); ?>



where recordsetName is the name of your recordset and DateColumn is the name of your data column

in the update behavior, bind the date column to the hidden element.

Sign in to reply to this post

paul377172

Thanks Jason

Sign in to reply to this post

Jason ByrnesWebAssist

you're welcome.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...