close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Insert, Update Dates in db

Thread began 3/18/2010 8:41 pm by mustang_sally_85344510 | Last modified 3/19/2010 1:47 pm by Eric Mittman | 504 views | 1 replies |


Insert, Update Dates in db

I have read a few of the other forums and haven't found an answer.

I am working in CS3, have super suite, php.

My question is...
Can dataAssist be used to update or calculate date fields to be inserted into the db?
Or do I need to write a seperate script to handle that.

I need to have 3 date fields in my db table.
Date created.
Subscription_Start date.
Subscription_End date.
(using DATETIME in my db table)

The subscription_end date should be able to be inserted and updated by "x" about of months purchased by the visitor/user.

How do I craft this into the dataAssist wizard...insert and update pages?
How do I get the datetime from the server?
I know that TIMESTAMP automatically inserts into the db, but haven't gotten datetime to auto insert.

Thank you in advance for any help you can give me.

Sign in to reply to this post

Eric Mittman

You can use the date type when inserting and updating the records. For you date added you probably want to use the time of the insert for the this. For the other values you can make use of php's date formatting functions to manipulate dates.

I'm sure that the start date will be chosen but the end date will need to be calculated. One way to do this would be to use the php mktime and date functions. This will require some hand coding to manipulate the dates the way that you will need them. Here is an example of how you could add x number of months to the start date to calculate the end date:

$subscription_months = <number of months in subscription>; //store the number of moths for the subscription

$hour = date("H", strtotime(Subscription_Start date)); //get the hour of the start time
$minute = date("i", strtotime(Subscription_Start date)); //get the minute of the start time
$second = date("s", strtotime(Subscription_Start date)); //get the second of the start time
$month = date("m", strtotime(Subscription_Start date)); //get the month of the start time
$day = date("d", strtotime(Subscription_Start date)); //get the day of the start time
$year = date("Y", strtotime(Subscription_Start date)); //get the year of the start time
$Subscription_End date = date("Y-m-d H:i:s", mktime($hour, $minute, $second, $month + $subscription_months, $day, $year)); //to calculate the end date use mktime and set it to the start date piece by peace, for the month you can just add the number of months that the user purchased. The date function here is formatting the timestamp that mktime creates to match the standard date and time formatting for date columns.

This method makes use of the date and times functions for php, here are links to these pages:




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





Ease of use


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...