Skip to content

Instantly share code, notes, and snippets.

@JacAbreu
Last active April 7, 2016 18:19
Show Gist options
  • Save JacAbreu/75ab3913cbd9db5ab08d41b256f063b8 to your computer and use it in GitHub Desktop.
Save JacAbreu/75ab3913cbd9db5ab08d41b256f063b8 to your computer and use it in GitHub Desktop.
Está bonito?
def createdAtFormatted
def dateCreated = ticket?.getCreatedAt()
try {
createdAtFormatted = format?.format(dateCreated)
} catch (Exception e) {
try {
def dateCreatedDate = format?.parse(dateCreated)
createdAtFormatted = format?.format(dateCreatedDate)
} catch (Exception ex) {
def formatDateComplete = new SimpleDateFormat("EEE MMM dd HH:mm:ss z yyyy", Locale.ENGLISH);
formatDateComplete.setTimeZone(TimeZone.getTimeZone("BRT"));
createdAtFormatted = formatDateComplete.parse(dateCreated)
createdAtFormatted = format.format(createdAtFormatted)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment