Forum Discussion

TwoFang's avatar
TwoFang
Contributor
6 years ago

about ${=Calendar.instance.getTime()} or ${=System.currentTimeMillis()} but not ${=LocalDate.now()}

Hi,

So I have since i dont know when been able to use System.currentTimeMillis() or Calendar.instance.getTime() directly requests or as part of a json request like below to get a timestamp
{
"date": "${=System.currentTimeMillis()}"
}
 
We slowly moving away from millisec toward more human readable isodates.
So i tried to use ${=LocalDate.now()} to get a nice date but this does not work.
I can get it to work by doing this ${=import java.time.LocalDate;LocalDate.now()} but feels ugly somehow

Anyway I'm curious to know why Calendar and System works out of the box while LocalDate does not?