use of java.text.SimpleDateFormat in project weixin-java-tools by chanjarster.
the class WxMpMiscAPITest method testGetUserCumulate.
@Test
public void testGetUserCumulate() throws WxErrorException, ParseException {
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
Date beginDate = simpleDateFormat.parse("2015-01-01");
Date endDate = simpleDateFormat.parse("2015-01-02");
List<WxMpUserCumulate> cumulates = wxService.getUserCumulate(beginDate, endDate);
System.out.println(cumulates);
Assert.assertNotNull(cumulates);
}
use of java.text.SimpleDateFormat in project deeplearning4j by deeplearning4j.
the class SerializingListener method processEvent.
/**
* This method is called at each epoch end
*
* @param event
* @param sequenceVectors
* @param argument
*/
@Override
public void processEvent(ListenerEvent event, SequenceVectors<T> sequenceVectors, long argument) {
try {
locker.acquire();
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");
StringBuilder builder = new StringBuilder(targetFolder.getAbsolutePath());
builder.append("/").append(modelPrefix).append("_").append(sdf.format(new Date())).append(".seqvec");
File targetFile = new File(builder.toString());
if (useBinarySerialization) {
SerializationUtils.saveObject(sequenceVectors, targetFile);
} else {
throw new UnsupportedOperationException("Not implemented yet");
}
} catch (Exception e) {
e.printStackTrace();
} finally {
locker.release();
}
}
use of java.text.SimpleDateFormat in project PhotoPicker by donglua.
the class ImageCaptureManager method createImageFile.
private File createImageFile() throws IOException {
// Create an image file name
String timeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss", Locale.ENGLISH).format(new Date());
String imageFileName = "JPEG_" + timeStamp + ".jpg";
File storageDir = Environment.getExternalStoragePublicDirectory(Environment.DIRECTORY_PICTURES);
if (!storageDir.exists()) {
if (!storageDir.mkdir()) {
Log.e("TAG", "Throwing Errors....");
throw new IOException();
}
}
File image = new File(storageDir, imageFileName);
// Save a file: path for use with ACTION_VIEW intents
mCurrentPhotoPath = image.getAbsolutePath();
return image;
}
use of java.text.SimpleDateFormat in project presentations by eburke.
the class LocationSubscribeFragment method showLocation.
private void showLocation(Location location) {
if (location == null) {
locationTextView.setText("No Location");
} else {
locationTextView.setText(location.toString());
}
// Update the timestamp so the user sees some kind of update even if the location didn't change.
SimpleDateFormat dateFormat = new SimpleDateFormat("HH:mm:ss");
timestampTextView.setText(dateFormat.format(new Date()));
}
use of java.text.SimpleDateFormat in project elastic-job by dangdangdotcom.
the class StatisticRdbRepository method getSummedTaskResultStatistics.
/**
* 获取合计后的任务运行结果统计数据.
*
* @param from 统计开始时间
* @param statisticInterval 统计时间间隔
* @return 合计后的任务运行结果统计数据对象
*/
public TaskResultStatistics getSummedTaskResultStatistics(final Date from, final StatisticInterval statisticInterval) {
TaskResultStatistics result = new TaskResultStatistics(0, 0, statisticInterval, new Date());
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String sql = String.format("SELECT sum(success_count), sum(failed_count) FROM %s WHERE statistics_time >= '%s'", TABLE_TASK_RESULT_STATISTICS + "_" + statisticInterval, formatter.format(from));
try (Connection conn = dataSource.getConnection();
PreparedStatement preparedStatement = conn.prepareStatement(sql);
ResultSet resultSet = preparedStatement.executeQuery()) {
while (resultSet.next()) {
result = new TaskResultStatistics(resultSet.getInt(1), resultSet.getInt(2), statisticInterval, new Date());
}
} catch (final SQLException ex) {
// TODO 记录失败直接输出日志,未来可考虑配置化
log.error("Fetch summed taskResultStatistics from DB error:", ex);
}
return result;
}
Aggregations