Skip to content

Instantly share code, notes, and snippets.

@thomasdarimont
Created August 27, 2014 11:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasdarimont/8bcee8554bb5189be6f4 to your computer and use it in GitHub Desktop.
Save thomasdarimont/8bcee8554bb5189be6f4 to your computer and use it in GitHub Desktop.
package de.tutorials.training;
import java.time.LocalDateTime;
public class SnapToCurrentTimeWindowExample {
public static void main(String[] args) {
LocalDateTime ldt = LocalDateTime.of(2013,9,1,13,39,0);
System.out.println(ldt);
// 2013-09-01T13:39
System.out.println(ldt.getHour() +":" + (ldt.getMinute() / 15) * 15);
//13:30
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment