This topic is locked
[SOLVED]

 Using the now() function

5/24/2011 4:35:56 PM
PHPRunner General questions
pplaut author

In the visual editor I have two fields.

PurchaseDate

WarrantyExpire
PurchaseDate the default value is set to now() works like a champ.
WarrantyDate the default value should be todays date + 365 days
What does not work:

Now()+ 365

various combinations of

strtotime("+365 day")

and

now and strtotime("+365 day")
I have a ticket open with support on this, but it is such a simple issue... I hate to bug them with this.

Any ideas?

Thanks!

Peer

M
mickna 5/25/2011

Not tested, just did a quick search:
SELECT NOW(), NOW() + INTERVAL 6 HOUR

result:

'2010-07-16 21:25:17', '2010-07-17 03:25:17'
OR:

SELECT DATE_ADD(now(), INTERVAL 6 HOUR);
May this also helps:

http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html
Hope this is a solution, as I did not test it...
Cheers,

mickna

Sergey Kornilov admin 5/25/2011

Try one of the following:
date('Y-m-d', strtotime('+1 week'))

date('Y-m-d', strtotime('+1 year'))

pplaut author 6/2/2011



Try one of the following:
date('Y-m-d', strtotime('+1 week'))

date('Y-m-d', strtotime('+1 year'))


This works like a champ...

Thanks Sergey!

Peer