If you use Apache commons-lang, you can use DateUtils
to round your dates:
Date now = new Date();
Date nearestMinute = DateUtils.round(now, Calendar.MINUTE);
More Related Contents:
- random number in java, I need number every 30, I mean 30-60-90
- Incrementing only the digits from an alphanumeric string
- Performance of java if-else with return statement [duplicate]
- How to format a String number into a US phone number format
- How can I pad an integer with zeros on the left?
- “Comparison method violates its general contract!”
- Recursively list files in Java
- Differences between Exception and Error
- If/else statements in ANTLR using listeners
- Android JSONObject – How can I loop through a flat JSON object to get each key and value
- Looking for an example for inserting content into the response using a servlet filter
- Read file from resources folder in Spring Boot
- java.lang.ClassNotFoundException: org.springframework.boot.SpringApplication Maven
- String array initialization in Java [duplicate]
- Using streams to convert a list of objects into a string obtained from the toString method
- Intersection of java.util.Map
- Can Java’s hashCode produce same value for different strings?
- JavaFX WARNING: Unsupported JavaFX configuration: classes were loaded from ‘unnamed module @…’
- How can I customize the title bar on JFrame?
- org.openqa.selenium.ElementNotVisibleException: Element is not currently visible while clicking a checkbox through SeleniumWebDriver and Java
- Log4j, configuring a Web App to use a relative path
- Lambda Expressions for Abstract Classes
- Converting from byte to int in Java
- Filtering a list of JavaBeans with Google Guava
- how to add jscrollpane to jframe?
- How to force IntelliJ to download javadocs with Maven?
- How to send post request to the below post method using postman rest client
- Filter mapping for everything to Struts2 besides one servlet?
- Easiest way to upgrade eclipse 3.7 to 4.2 (Juno)
- How to obtain the location of cacerts of the default java installation?