This topic is locked

default date value

7/9/2008 10:39:15 AM
PHPRunner General questions
G
griller author

Hi

I have to fields 1. dateadded 2. dateexpires

On my record add page I have set the default value of dateadded field to now() which works fine

What I need to do is set a default value for dateexpires field so it adds a value of todays date + 12 months.

Something like DATE_ADD(CURDATE(), INTERVAL 12 MONTH) which doesn't work by the way <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=8950&image=1&table=forumtopics' class='bbc_emoticon' alt=':(' />

Any help please

J
Jane 7/10/2008

Hi,
try to use following default value for dateexpires field:

date("Y-m-d",strtotime("+12 month"))

G
griller author 7/10/2008

Thanks, That does just what I wanted to do. <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=30935&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />