KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
Currently I'm using the following code to get year, month, day of month, hour and minute in Groovy: Date now = new Date() Integer year = now.year + 1900 Integer month = now.month + 1 Integer day = now.getAt(Calendar.DAY_OF_MONTH) // inconsistent! Integer hour = now.hours Integer minute = now.minutes // Code that uses year, month, day, hour and minute goes here Using getAt(Calendar.DAY_OF_MONTH) for the day of the month seems a bit inconsistent in this context. Is there any shorter way to obtain the day of the month?
Tags (comma-separated)
Save Edits
Cancel