2 Replies Latest reply on Feb 22, 2015 11:30 AM by raybaudi

# Caluculation referencing current date

### Title

Caluculation referencing current date

### Post

Background:

There is a testing program with (3) annual testing windows (Jan, May, and July). I created a field "Testing Window" and need a calculation to auto-populate based on when a student registers.

I have a two-part question:

1. How do I reference the current date in a calclulation?

I'm embarrassed, but I couldn'd figure out how to do this. My work around was to create a field in my table called "Current Date", use the Get (CurrentDate) function, and reference this field in my calculation. Is there a way to simply reference the current date directly in the calculation without having to create a field?

2. What am I doing wrong?

Case (
Month (Current Date) = 1; "Jan " (Year (Current Date));
Month (Current Date)  ≥ 2 and Month (Current Date)  ≤ 5; "May " (Year (Current Date));
Month (Current Date)  ≥ 6 and Month (Current Date)  ≤ 7; "July " (Year (Current Date));

"Jan " (Year (Current Date) +1))

• ###### 1. Re: Caluculation referencing current date

Get ( current date ) works the same in your calculation as in a calculation field.

But your calculations I'm your example should be: month ( get ( currentdate ) ).

• ###### 2. Re: Caluculation referencing current date

Let(
d = Get ( CurrentDate ) ;
Case(
Month ( d ) < 2 ; "Jan " & Year ( d ) ;
Month ( d ) < 6 ; "May " & Year ( d ) ;
Month ( d ) < 8 ; "Jul " & Year ( d ) ;
"Jan " & ( Year ( d ) + 1 )
)
)