public static java . util . Date newDateTime ( ) { return new java . util . Date ( ( System . currentTimeMillis ( ) / SECOND_MILLIS ) * SECOND_MILLIS ) ; }
Create a new DateTime . To the last second . This will not create any extra - millis - seconds which may cause bugs when writing to stores such as databases that round milli - seconds up and down .