All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mageddo.tobby.internal.utils.LocalDateTimes Maven / Gradle / Ivy

There is a newer version: 2.1.6-alpha
Show newest version
package com.mageddo.tobby.internal.utils;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZonedDateTime;

/**
 * Utils for dates, UTC is the used timezone
 */
public class LocalDateTimes {

  public static final ZoneId UTC_ZONED_ID = ZoneId.of("UTC");

  public static LocalDateTime now() {
    return ZonedDateTime
        .now(UTC_ZONED_ID)
        .toLocalDateTime();
  }

  public static LocalDateTime daysAgo(int daysAgo) {
    return now().minusDays(daysAgo);
  }

  public static LocalDateTime daysInTheFuture(int daysToSum) {
    return now().plusDays(daysToSum);
  }

  public static LocalDateTime minutesAgo(int minutes) {
    return now().minusMinutes(minutes);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy