88
Views
7
Comments
Solved
Default date set 1 year from CurrDate()
Question

Hi,

I have a entity attribute of DateCreated with the data type of Date. However, in my database, i want to set the default value as one year from CurrDate(). How do i express this correctly in the "Default value" input? 

Rank: #373
Solution

Hi, friend.

Normally you could use the function AddYears(CurrDate(),1) but it does not working as Default Value to attributes.

If you need to save this attribiute as one year from current date, just pass the function AddYears(CurrDate(),1) in your save methods, because I don't a way to set this value there as you want.


Rank: #6386

Hi Lenon and Salman

i think i will just use AddYears(CurrDate(),1), in the forms instead. Thank you for helping!


Champion
Rank: #40

Jolene Kwek wrote:

Hi Lenon and Salman

i think i will just use AddYears(CurrDate(),1), in the forms instead. Thank you for helping!


Yes that why platform provide us the AddYears function.


Champion
Rank: #40

Jolene Kwek wrote:

Hi,

I have a entity attribute of DateCreated with the data type of Date. However, in my database, i want to set the default value as one year from CurrDate(). How do i express this correctly in the "Default value" input? 

Hi Jolene


you dont want to pass createddate from frontend??

OR

If you have to pass createddate then you can do by AddYears(currdate(),1)


Rank: #373

I'm glad to help!


Best regards

Rank: #14444

Sir ,

Related to the above question, how if i want to calculate Year ( CurrentDate) - 1 years?

Thank you in advance

Rank: #171


Hi haslina, follow the example:


AddYears(CurrDate(), -1)


Regards.