Set time in date groovy

Code examples

1
0

get date now groovy

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)

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Балгарскі
..................................................................................................................
Íslensk
..................................................................................................................