List of usage examples for java.sql Timestamp valueOf
@SuppressWarnings("deprecation") public static Timestamp valueOf(LocalDateTime dateTime)
From source file:libepg.epg.section.eventinformationtable.EventInformationTableRepeatingPartTest.java
/** * Test of getStopTime_Object method, of class * EventInformationTableRepeatingPart.//w w w . ja v a 2 s . c o m */ @Test public void testGetStopTime_Object() throws Exception { LOG.debug("getStopTime_Object"); EventInformationTableRepeatingPart instance = target; Timestamp expResult = Timestamp.valueOf("2016-03-21 18:25:00.0"); ; Timestamp result = instance.getStopTime_Object(); assertEquals(expResult, result); }
From source file:com.hihframework.core.utils.DateUtils.java
/** * java.sql.Date?java.sql.Timestamp "23:59:59.999" * * @param date java.sql.Date ??Date//from w ww . j av a2 s. c o m * @return java.sql.Timestamp ??Timestamp */ public static Timestamp convertDateToTimestampMax(java.sql.Date date) { return Timestamp.valueOf(date.toString() + " 23:59:59.999"); }
From source file:org.apache.lens.server.user.LDAPBackedDatabaseUserConfigLoader.java
@Override public Map<String, String> getUserConfig(final String loggedInUser) throws UserConfigLoaderException { try {//from www. j ava 2 s . c o m final String[] intermediateKey = intermediateCache.get(loggedInUser, new Callable<String[]>() { @Override public String[] call() throws Exception { String[] config = queryDatabase(intermediateQuerySql, true, loggedInUser, Timestamp.valueOf(DateTime.now().toString(DATE_TIME_FORMATTER))); if (config == null) { config = getAttributes(loggedInUser); Object[] updateArray = new Object[config.length + 2]; for (int i = 0; i < config.length; i++) { updateArray[i + 1] = config[i]; } updateArray[0] = loggedInUser; updateArray[config.length + 1] = Timestamp .valueOf(DateTime.now().plusHours(expiryHours).toString(DATE_TIME_FORMATTER)); QueryRunner runner = new QueryRunner(ds); runner.update(intermediateDeleteSql, loggedInUser); runner.update(intermediateInsertSql, updateArray); } return config; } }); return cache.get(intermediateKey, new Callable<Map<String, String>>() { @Override public Map<String, String> call() throws Exception { final String[] argsAsArray = queryDatabase(querySql, false, intermediateKey); if (argsAsArray.length != keys.length) { throw new UserConfigLoaderException( "size of columns retrieved by db query(" + argsAsArray.length + ") " + "is not equal to the number of keys required(" + keys.length + ")."); } return new HashMap<String, String>() { { for (int i = 0; i < keys.length; i++) { put(keys[i], argsAsArray[i]); } } }; } }); } catch (ExecutionException e) { throw new UserConfigLoaderException(e); } }
From source file:io.manasobi.utils.DateUtils.java
public static Timestamp convertToTimestamp(String dateTime, String pattern) { return Timestamp.valueOf(convertToDateTime(dateTime, pattern)); }
From source file:io.manasobi.utils.DateUtils.java
public static Timestamp convertToTimestamp(String dateTime) { return Timestamp.valueOf(convertToDateTime(dateTime, DATE_TIME_PATTERN)); }
From source file:de.tudarmstadt.ukp.wikipedia.revisionmachine.api.Revision.java
/** * Sets the timestamp information./*from w w w . j av a 2 s . c o m*/ * * The input is expected to be the wikipedia version of the timestamp as * String (YYYY-MM-DDThh-mm-ssZ). T and Z will be replaced with spaces. * * @param timeStamp * timestamp (wikipedia version) */ public void setTimeStamp(final String timeStamp) { String time = timeStamp.replace('T', ' '); time = time.replace('Z', ' '); this.timeStamp = Timestamp.valueOf(time); }
From source file:org.wso2.carbon.identity.application.authenticator.fido.u2f.U2FService.java
public void removeRegistration(FIDOUser user, String deviceRemarks) throws FIDOAuthenticatorServerException { DeviceStoreDAO.getInstance().removeRegistration(user.getUserName(), user.getTenantDomain(), user.getUserStoreDomain(), Timestamp.valueOf(deviceRemarks)); }
From source file:org.kuali.ext.mm.ObjectUtil.java
/** * convert the given string into a timestamp object if the string is in the valid format of timestamp * * @param value the given string/*from ww w . j a va 2 s .co m*/ * @return a timestamp converted from the given string */ public static Timestamp formatTimeStamp(String value) { Timestamp formattedTimestamp = null; String pattern = "^(\\d{1,4}-\\d{1,2}-\\d{1,2} \\d{1,2}:\\d{1,2}:\\d{1,2}(\\.\\d{1,9})?)$"; boolean isTimestamp = value != null && value.matches(pattern); try { if (isTimestamp) { formattedTimestamp = Timestamp.valueOf(value); } else { formattedTimestamp = new Timestamp(formatDate(value).getTime()); } } catch (Exception e) { return formattedTimestamp; } return formattedTimestamp; }
From source file:io.manasobi.utils.DateUtils.java
public static Timestamp convertToTimestamp(long timeMillis) { return Timestamp.valueOf(convertToDateTime(timeMillis)); }