cancel
Showing results for 
Search instead for 
Did you mean: 

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

Occasional Contributor

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?

1 REPLY 1
Highlighted
Community Hero

New Here?
Join us and watch the welcome video:
Announcements
TechCorner Leaderboard
Want a fun and easy way to learn ReadyAPI and show off your skills? Try solving weekly TechCorner challenges and get into the Leaderboard!


Challenge Status

Get a full Raw JMS request

Participate!

Compare an expected JSON value and actual response in Events

Participate!

Fetch value/data from JSON response using Groovy Script

See replies!

Get data from Petstore and add it to Excel sheets

Participate!
Top Kudoed Authors