1

I want to convert the current date (in groovy)

 def currentDate= new Date() 
 println currentDate
 Tue Dec 30 14:48:00 EST 2014

into (that is hour and minute format) 1448 or 14:48

1 Answer 1

1

You can try Date.format:

new Date().format('HHmm')
new Date().format('HH:mm')
3
  • @elyon: is that what You were looking for?
    – Opal
    Commented Dec 31, 2014 at 14:39
  • how do i get current day of the week from the current date...something like 'Tue Dec 30 14:48:00 EST 2014' = Tue
    – elyon
    Commented Jan 6, 2015 at 16:13
  • new Date().format('EEE') - see here: docs.oracle.com/javase/7/docs/api/java/text/…
    – Opal
    Commented Jan 6, 2015 at 16:21

Not the answer you're looking for? Browse other questions tagged or ask your own question.