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 5:41 pm by mustang_sally_85344510 | Last modified 3/19/2010 10:47 am by mustang_sally_85344510 | 546 views | 1 replies

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:




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