What am I missing trying to get a date to display correctly?


#1

I tried searching, looking at code, etc; but I just don’t understand how to properly get a date to show up properly:

Here’s the line of code that I thought was simple enough:

def timeString = new Date().format("yyyy-mm-dd h:mm a", location.timeZone)

Can anyone give me a pointer on what I’m doing wrong? I know it has to be something super simple…


(sidjohn1) #2

Date format is case sensitive, yyyy-MM-dd h:mm a will get yo closer


(Ron) #3

Docs are here
http://docs.oracle.com/javase/7/docs/api/java/text/SimpleDateFormat.html

MM = month
mm = minutes in hour


#4

Thanks guys! Appreciate the doc link @Ron, thank you.