create a date calculated field for my table

KoushikChava
Kilo Contributor

How do i create a date calculated field in a table.

I want to  create a calculated field with my current date field and add 20 days to it to create a new field

1 ACCEPTED SOLUTION

Allen Andreas
Administrator
Administrator

Hello,

Are you wanting this field to update every day, to today it's today+20 and then tomorrow is it, tomorrow+20?

So each day it just shows that current date and adds 20?

If so, a calculated field won't work for you. Calculated fields are meant for static information and is only updated/evaluated to be updated, whenever the record is updated. So it won't check itself every day.

If you're only wanting to be current date + 20, once, when the record is created, for example...then you could just use script in the default value for the field to do that, without a calculation.

Such as:

javascript:var gdt = new GlideDateTime(); gdt.addDays(20); gdt;

If it's a Date/Time field, if it's just date then you can use:

javascript:var gd = new GlideDate(); gd.addDays(20); gd;

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

View solution in original post

2 REPLIES 2

Allen Andreas
Administrator
Administrator

Hello,

Are you wanting this field to update every day, to today it's today+20 and then tomorrow is it, tomorrow+20?

So each day it just shows that current date and adds 20?

If so, a calculated field won't work for you. Calculated fields are meant for static information and is only updated/evaluated to be updated, whenever the record is updated. So it won't check itself every day.

If you're only wanting to be current date + 20, once, when the record is created, for example...then you could just use script in the default value for the field to do that, without a calculation.

Such as:

javascript:var gdt = new GlideDateTime(); gdt.addDays(20); gdt;

If it's a Date/Time field, if it's just date then you can use:

javascript:var gd = new GlideDate(); gd.addDays(20); gd;

Please mark reply as Helpful/Correct, if applicable. Thanks!


Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

Hi,

No, I am looking for date/time column which is already populated with data from last couple of years. I want to add 20 days to that specific column. and i appreciate for you response.