HsqlDateTime.java (hsqldb-2.7.0) | : | HsqlDateTime.java (hsqldb-2.7.1) | ||
---|---|---|---|---|
skipping to change at line 61 | skipping to change at line 61 | |||
* | * | |||
* Was reviewed for 1.7.2 resulting in centralising all DATETIME related | * Was reviewed for 1.7.2 resulting in centralising all DATETIME related | |||
* operations.<p> | * operations.<p> | |||
* | * | |||
* From version 2.0.0, HSQLDB supports TIME ZONE with datetime types. The | * From version 2.0.0, HSQLDB supports TIME ZONE with datetime types. The | |||
* values are stored internally as UTC seconds from 1970, regardless of the | * values are stored internally as UTC seconds from 1970, regardless of the | |||
* time zone of the JVM, and converted as and when required, to the local | * time zone of the JVM, and converted as and when required, to the local | |||
* timezone. | * timezone. | |||
* | * | |||
* @author Fred Toussi (fredt@users dot sourceforge.net) | * @author Fred Toussi (fredt@users dot sourceforge.net) | |||
* @version 2.7.0 | * @version 2.7.1 | |||
* @since 1.7.0 | * @since 1.7.0 | |||
*/ | */ | |||
public class HsqlDateTime { | public class HsqlDateTime { | |||
public static final Locale defaultLocale = Locale.UK; | public static final Locale defaultLocale = Locale.UK; | |||
private static final Calendar tempCalDefault = new GregorianCalendar(); | private static final Calendar tempCalDefault = new GregorianCalendar(); | |||
private static final Calendar tempCalGMT = | private static final Calendar tempCalGMT = | |||
new GregorianCalendar(TimeZone.getTimeZone("GMT"), defaultLocale); | new GregorianCalendar(TimeZone.getTimeZone("GMT"), defaultLocale); | |||
private static final String sdfdPattern = "yyyy-MM-dd"; | private static final String sdfdPattern = "yyyy-MM-dd"; | |||
private static final SimpleDateFormat sdfd = | private static final SimpleDateFormat sdfd = | |||
new SimpleDateFormat(sdfdPattern); | new SimpleDateFormat(sdfdPattern, defaultLocale); | |||
private static final String sdftPattern = "HH:mm:ss"; | ||||
private static final SimpleDateFormat sdft = | ||||
new SimpleDateFormat(sdftPattern); | ||||
private static final String sdftsPattern = "yyyy-MM-dd HH:mm:ss"; | private static final String sdftsPattern = "yyyy-MM-dd HH:mm:ss"; | |||
private static final SimpleDateFormat sdfts = | private static final SimpleDateFormat sdfts = | |||
new SimpleDateFormat(sdftsPattern); | new SimpleDateFormat(sdftsPattern, defaultLocale); | |||
private static final String sdftsSysPattern = "yyyy-MM-dd HH:mm:ss.SSS"; | private static final String sdftsSysPattern = "yyyy-MM-dd HH:mm:ss.SSS"; | |||
private static final SimpleDateFormat sdftsSys = | private static final SimpleDateFormat sdftsSys = | |||
new SimpleDateFormat(sdftsSysPattern); | new SimpleDateFormat(sdftsSysPattern, defaultLocale); | |||
private static final Date sysDate = new java.util.Date(); | private static final Date sysDate = new java.util.Date(); | |||
static { | static { | |||
TimeZone.getDefault(); | TimeZone.getDefault(); | |||
tempCalGMT.setLenient(false); | tempCalGMT.setLenient(false); | |||
sdfd.setCalendar(new GregorianCalendar(TimeZone.getTimeZone("GMT"), | sdfd.setCalendar(new GregorianCalendar(TimeZone.getTimeZone("GMT"), | |||
defaultLocale)); | defaultLocale)); | |||
sdfd.setLenient(false); | sdfd.setLenient(false); | |||
sdft.setCalendar(new GregorianCalendar(TimeZone.getTimeZone("GMT"), | ||||
defaultLocale)); | ||||
sdft.setLenient(false); | ||||
sdfts.setCalendar(new GregorianCalendar(TimeZone.getTimeZone("GMT"), | sdfts.setCalendar(new GregorianCalendar(TimeZone.getTimeZone("GMT"), | |||
defaultLocale)); | defaultLocale)); | |||
sdfts.setLenient(false); | sdfts.setLenient(false); | |||
} | } | |||
public static long getDateSeconds(String s) { | public static long getDateSeconds(String s) { | |||
try { | try { | |||
synchronized (sdfd) { | synchronized (sdfd) { | |||
java.util.Date d = sdfd.parse(s); | java.util.Date d = sdfd.parse(s); | |||
End of changes. 5 change blocks. | ||||
10 lines changed or deleted | 4 lines changed or added |