List of usage examples for org.apache.commons.lang.time DateFormatUtils format
public static String format(Date date, String pattern)
Formats a date/time into a specific pattern.
From source file:net.sourceforge.fenixedu.util.CalendarUtil.java
public static String time2string(Date time) { return DateFormatUtils.format(time, "HHmmss"); }
From source file:com.baidu.fsg.uid.utils.DateUtils.java
/** * Format date by 'yyyy-MM-dd HH:mm:ss' pattern * * @param date/*from ww w. j a va2 s.c o m*/ * @return */ public static String formatByDateTimePattern(Date date) { return DateFormatUtils.format(date, DATETIME_PATTERN); }
From source file:ch.systemsx.cisd.openbis.generic.server.dataaccess.db.PermIdDAO.java
public String createPermId() { long id = getNextSequenceId(SequenceNames.PERM_ID_SEQUENCE); return DateFormatUtils.format(new Date(), PERM_ID_DATE_FORMAT_PATTERN) + "-" + Long.toString(id); }
From source file:com.app.simple.utils.gps.SimpleStringJoin.java
/** * /*w w w. j av a 2 s. c o m*/ * * @description <p> * ? * </p> * * @Author Chris Yu * * @createDate 2014-5-9 ?11:06:52 * * @return */ public SimpleStringJoin startJoin() { simpleStrJoin.append(ANSWER_PREFIX); simpleStrJoin.append(DateFormatUtils.format(new Date(), DATE_FROMAT_STR)); return this; }
From source file:h2weibo.S3BackupTask.java
public void run() { String dump = getHelper().dump(); try {/* w w w.j a va2s.c o m*/ AWSCredentials awsCredentials = new AWSCredentials(awsAccessKey, awsSecretAccessKey); S3Service s3Service = new RestS3Service(awsCredentials); S3Bucket backup = s3Service.getBucket("h2weibo.backup"); String dateString = DateFormatUtils.format(new Date(), "yyyy-MM-dd_HH"); S3Object object = new S3Object(dateString + ".json", dump); object = s3Service.putObject(backup, object); System.out.println("S3Object after upload: " + object); } catch (Exception e) { log.error("Failed to upload to S3."); log.error(e); } }
From source file:com.autonomy.aci.client.services.impl.ErrorProcessorTest.java
@Test public void testFullErrorResponse() throws XMLStreamException, AciErrorException, ProcessorException { try {// w w w .j a v a2 s. c o m // Execute the processor... processor.process(XmlTestUtils.getResourceAsXMLStreamReader( "/com/autonomy/aci/client/services/processor/errorProcessorTestFullErrorResponse.xml")); fail("Should have thrown an AciErrorException"); } catch (final AciErrorException exception) { // Check it... assertThat("errorId property not as expected.", exception.getErrorId(), is(equalTo("AutonomyIDOLServerWOBBLE1"))); assertThat("rawErrorId property not as expected.", exception.getRawErrorId(), is(nullValue())); assertThat("errorString property not as expected.", exception.getErrorString(), is(equalTo("ERROR"))); assertThat("errorDescription property not as expected.", exception.getErrorDescription(), is(equalTo("The requested action was not recognised"))); assertThat("errorCode property not as expected.", exception.getErrorCode(), is(equalTo("ERRORNOTIMPLEMENTED"))); assertThat("errorTime property not as expected.", DateFormatUtils.format(exception.getErrorTime(), "dd MMM yy HH:mm:ss"), is(equalTo("06 Feb 06 17:03:54"))); } }
From source file:net.duckling.ddl.service.browselog.impl.BrowseLogServiceImpl.java
private String buildJobName(Date currentDay) { return "pageview" + DateFormatUtils.format(currentDay, "yyyy-MM-dd"); }
From source file:net.duckling.ddl.service.resource.PageUnlockJobWorker.java
private String buildJobName(Date currentDay) { return "pageUnlockJob" + DateFormatUtils.format(currentDay, "yyyy-MM-dd HH:mm"); }
From source file:cn.ipanel.apps.portalBackOffice.util.CommonsFiend.java
public static String getCurrentDate() { return DateFormatUtils.format(Calendar.getInstance().getTime(), Defines.FORMAT_DATE_STRING); }
From source file:gov.nih.nci.ess.ae.DomainToGridObjectConverter.java
private TSDateTime convert(Date date) { TSDateTime tsDateTime = new TSDateTime(); if (date != null) { tsDateTime.setValue(DateFormatUtils.format(date, TS_DATETIME_PATTERN)); } else {/* ww w . j a va 2 s .c o m*/ tsDateTime.setNullFlavor(NullFlavor.NI); } return tsDateTime; }