Skip to content
This repository has been archived by the owner on Jul 28, 2023. It is now read-only.

Commit

Permalink
using fixed milliseconds for the JSON date
Browse files Browse the repository at this point in the history
  • Loading branch information
musketyr committed Jul 18, 2019
1 parent 1401979 commit 2aa3eb6
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,22 @@ package grails.plugin.awssdk.util

import java.time.Instant
import java.time.format.DateTimeFormatter
import java.time.format.DateTimeFormatterBuilder

/**
* @deprecated use <code>java.time</code> classes directly
*/
@Deprecated
class JsonDateUtils {

public static final DateTimeFormatter ISO_FORMAT_MILLIS = new DateTimeFormatterBuilder().appendInstant(3).toFormatter();

static Date parseJsonDate(String date) {
Date.from(Instant.parse(date))
}

static String formatDate(Date date) {
DateTimeFormatter.ISO_INSTANT.format(date.toInstant())
ISO_FORMAT_MILLIS.format(date.toInstant())
}

}

0 comments on commit 2aa3eb6

Please sign in to comment.