Skip to content

Instantly share code, notes, and snippets.

@JorgenRingen
Created January 27, 2019 15:38
Show Gist options
  • Save JorgenRingen/15c075cd82f9552d14bc23968d087e57 to your computer and use it in GitHub Desktop.
Save JorgenRingen/15c075cd82f9552d14bc23968d087e57 to your computer and use it in GitHub Desktop.
DateTimeFormatter timeFormatter = new DateTimeFormatterBuilder()
.appendValue(HOUR_OF_DAY, 2)
.appendLiteral(':')
.appendValue(MINUTE_OF_HOUR, 2)
.optionalStart()
.appendLiteral(':')
.appendValue(SECOND_OF_MINUTE, 2)
.toFormatter();
return LocalTime.now().format(timeFormatter);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment