junaidp
junaidp

Reputation: 11201

Does groovy have date literals?

Following code does not work -

new Date(2011-10-01)

What is the format of specifying date literals in Groovy?

Upvotes: 1

Views: 592

Answers (1)

Dave Newton
Dave Newton

Reputation: 160201

There's no concept of a "date literal" in either Groovy or Java.

See the Java Date API and/or the Groovy Date API.

If you want to create a date from a string, you need to parse it (or use DateFormat.parse()), or use Groovy-style dates.

Upvotes: 6

Related Questions