calculation on date
Hi
Using the ecart object calculation panel, is it possible to make a calculation on date. I am trying to substract 30 days from date column value but its returns … nothing
Pierre
Hi
Using the ecart object calculation panel, is it possible to make a calculation on date. I am trying to substract 30 days from date column value but its returns … nothing
Pierre
This depends on how you are storing the Date format. What date format are you using to store the date in your database?
hi,
dates were store as varchar, stupid off course. I have changed it to date and now a value is returned but it's a 4 digit value !! What am i missing here ?
Pierre
OK, i have done some more testing and in order to accomplish this we need to use the php timestamp to be able to subtract the 30 days. first, please update your date column to use the timestamp. This will store the date in the following format:
2010-11-30 17:47:32
Then your calculation should be something similar to this:
strtotime([dateColumn1]) - (30*24*60*60)
basically we convert the date to a timestamp and then subtract 30 days.
let me know if you have any questions.
Thanks you've put me on the right track. Your calculation works just fine. No need to change to column to timestamp though. It works with date. After that it's just a matter of reformatting the timestamp to appear as regular date.
Pierre
Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.
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.