Default Datetime - Exact syntax in GUI Field - Add Days to now on create

pvcon13's profile image pvcon13 posted 4 years ago in General Permalink

For Time DATETIME NOT ALLOW NULL to set a default that is

the current timestamp or the current Date PLUS 1 week.

Have tried about 50 permutations of date_add Interval and TIMESTAMPADD with date seeds (all dynamic) including current_timestamp, date, now. All I get is syntax error in the GUI field on Save.

I know how to do this in Javascript, but need to set a default and it has to be in the future atleast one or more days from now. On create only not update.

I suspect the syntax in this field is somehow slightly different then a mysql statement.

ansgar's profile image ansgar posted 4 years ago Permalink

Did you try using the table designer's default editor?

Description

pvcon13's profile image pvcon13 posted 4 years ago Permalink

Yes and when I do each instance I create fails. I selected all time adjustment functions using those tools, and the composite nature seems to be causing an errors message.

pvcon13's profile image pvcon13 posted 4 years ago Permalink

for example CONVERT(DATE_ADD(curdate(), INTERVAL 1 WEEK), DATETIME)

TIMESTAMPADD(WEEK,1,CURRENT_TIMESTAMP)

pvcon13's profile image pvcon13 posted 4 years ago Permalink

I think its related to embedded function parans. I tried with and without them. Do they have to be escaped in some way?

Please login to leave a reply, or register at first.