New Date Groovy

[Solved] New Date Groovy | Groovy - Code Explorer | yomemimo.com
Question : get date now groovy

Answered by : andry

import java.text.SimpleDateFormat
import java.util.Date
Date now = new Date();
Calendar calendar = Calendar.getInstance();
calendar.setTime(now);
int yearNow = calendar.get(Calendar.YEAR)
int monthNow = calendar.get(Calendar.MONTH)
int dayNow = calendar.get(Calendar.DAY_OF_MONTH)

Source : | Last Update : Thu, 18 Mar 21

Question : new date groovy

Answered by : doubtful-dog-4dmm985gva4o

// takes the date encoded as milliseconds since midnight, January 1, 1970 UTC
def mydate = new Date(System.currentTimeMillis())
// create from an existing Calendar object
def mydate = new GregorianCalendar(2014, Calendar.APRIL, 3, 1, 23, 45).time

Source : https://stackoverflow.com/questions/22848000/how-to-create-new-date-in-groovy-at-specific-date-and-time | Last Update : Mon, 11 May 20

Answers related to new date groovy

Code Explorer Popular Question For Groovy