@Override public String timestamp( long timeWritten, TimeZone timeZone ) { return Format.date( timeWritten, timeZone ) + "/" + timeWritten; } }
public static String date() { return date( DEFAULT_TIME_ZONE ); }
public static String date( Date date ) { return date( date, DEFAULT_TIME_ZONE ); }
public static String date( long millis ) { return date( millis, DEFAULT_TIME_ZONE ); }
public static String date( TimeZone timeZone ) { return date( new Date(), timeZone ); }
public static String date( long millis, TimeZone timeZone ) { return date( new Date( millis ), timeZone ); }
private void printStageHeader( String name, Object... data ) { System.out.println( name + " " + date( TimeZone.getDefault() ) ); if ( data.length > 0 ) { for ( int i = 0; i < data.length; ) { System.out.println( " " + data[i++] + ": " + data[i++] ); } } }
@Override public void start( StageExecution execution ) { out.println( execution.name() + ", started " + date() ); lastProgress = 0; }
private void printDetailsHeadline() { out.println(); out.println(); printIndented( out, "******** DETAILS " + date() + " ********" ); out.println(); // Make sure that if user is interested in details then also print the entire details set when import is done printDetailsOnDone = true; monitor.detailsPrinted(); }
@Test void dateTime() throws Exception { // Date long timeWithDate = System.currentTimeMillis(); String dateAsString = Format.date( timeWithDate ); assertEquals( timeWithDate, new SimpleDateFormat( Format.DATE_FORMAT ).parse( dateAsString ).getTime() ); // Time String timeAsString = Format.time( timeWithDate ); assertEquals( timeWithDate, translateToDate( timeWithDate, new SimpleDateFormat( Format.TIME_FORMAT ).parse( timeAsString ).getTime(), Format.DEFAULT_TIME_ZONE ) ); }
@Override public String toString() { TransactionRepresentation tr = this.transactionRepresentation; return "Transaction #" + transactionId + (logPosition != null ? " at log position " + logPosition : " (no log position)") + " {started " + date( tr.getTimeStarted() ) + ", committed " + date( tr.getTimeCommitted() ) + ", with " + countCommands() + " commands in this transaction" + ", authored by " + tr.getAuthorId() + ", with master id " + tr.getMasterId() + ", lock session " + tr.getLockSessionId() + ", latest committed transaction id when started was " + tr.getLatestCommittedTxWhenStarted() + ", additional header bytes: " + HexPrinter.hex( tr.additionalHeader(), Integer.MAX_VALUE, "" ) + "}"; }
@Test void dateTimeWithTimeZone() throws Exception { String zoneOffset = "+03:00"; TimeZone zone = TimeZone.getTimeZone( "GMT" + zoneOffset ); // Date String asString = Format.date( zone ); assertTrue( asString.endsWith( withoutColon( zoneOffset ) ) ); long timeWithDate = new SimpleDateFormat( Format.DATE_FORMAT ).parse( asString ).getTime(); asString = Format.date( timeWithDate, zone ); assertTrue( asString.endsWith( withoutColon( zoneOffset ) ) ); assertEquals( timeWithDate, new SimpleDateFormat( Format.DATE_FORMAT ).parse( asString ).getTime() ); asString = Format.date( new Date( timeWithDate ), zone ); assertTrue( asString.endsWith( withoutColon( zoneOffset ) ) ); assertEquals( timeWithDate, new SimpleDateFormat( Format.DATE_FORMAT ).parse( asString ).getTime() ); // Time asString = Format.time( timeWithDate, zone ); assertEquals( timeWithDate, translateToDate( timeWithDate, new SimpleDateFormat( Format.TIME_FORMAT ).parse( asString ).getTime(), zone ) ); asString = Format.time( new Date( timeWithDate ), zone ); assertEquals( timeWithDate, translateToDate( timeWithDate, new SimpleDateFormat( Format.TIME_FORMAT ).parse( asString ).getTime(), zone ) ); }
public static String date( long millis ) { return date( millis, DEFAULT_TIME_ZONE ); }
@Override public String timestamp( long timeWritten, TimeZone timeZone ) { return Format.date( timeWritten, timeZone ) + "/" + timeWritten; } }
public static String date( Date date ) { return date( date, DEFAULT_TIME_ZONE ); }
public static String date( TimeZone timeZone ) { return date( new Date(), timeZone ); }
public static String date( long millis, TimeZone timeZone ) { return date( new Date( millis ), timeZone ); }
private void printStageHeader( String name, Object... data ) { System.out.println( name + " " + date( TimeZone.getDefault() ) ); if ( data.length > 0 ) { for ( int i = 0; i < data.length; ) { System.out.println( " " + data[i++] + ": " + data[i++] ); } } }
@Override public void start( StageExecution execution ) { out.println( execution.name() + ", started " + date() ); lastProgress = 0; }
private void printDetailsHeadline() { out.println(); out.println(); printIndented( out, "******** DETAILS " + date() + " ********" ); out.println(); // Make sure that if user is interested in details then also print the entire details set when import is done printDetailsOnDone = true; monitor.detailsPrinted(); }