[OmniFaces utilities] The
formatRFC1123()
method formats the given Date
to a string in RFC1123 format. This format is used in HTTP headers and in JavaScript Date
constructor.[OmniFaces utilities] The
parseRFC1123()
method parses the given string in RFC1123 format to a Date
object.Methods:
Usage:
Date to a string in RFC1123 format:
import org.omnifaces.util.Utils;
...
Date today =
new Date();
// Fri, 08
May 2015 10:28:49 GMT
String rfc1123Date =
Utils.formatRFC1123(today);
RFC1123 to
Date:
import
org.omnifaces.util.Utils;
...
try {
// Fri May 08 13:28:49 EEST 2015
Date today =
Utils.parseRFC1123(rfc1123Date);
} catch (ParseException ex) {
...
}
Niciun comentariu :
Trimiteți un comentariu