Class DateTimeUtils

java.lang.Object
com.deco2800.game.utils.DateTimeUtils

public class DateTimeUtils
extends java.lang.Object
  • Constructor Summary

    Constructors 
    Constructor Description
    DateTimeUtils()  
  • Method Summary

    Modifier and Type Method Description
    static java.time.LocalDateTime getCurrentDateTime()
    Returns the current date and time in local time zone, based on the one that is set on the operating system
    static java.lang.String getFormattedDate​(java.time.LocalDateTime dateTime)
    Returns the date in a verbose format Example: 31/12/2021
    static java.lang.String getFormattedDateTime​(java.time.LocalDateTime dateTime)
    Returns prettified date and time Example: 2021-09-15 11:38 PM
    static java.lang.String getFormattedTime​(java.time.LocalDateTime dateTime)
    Prettifies the time and returns it Example: 05:55:23 AM
    static java.lang.String getVerboseDate​(java.time.LocalDateTime dateTime)
    Returns the date in a verbose format Example: Tuesday, 31 December, 2021

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

  • Method Details

    • getFormattedTime

      public static java.lang.String getFormattedTime​(java.time.LocalDateTime dateTime)
      Prettifies the time and returns it Example: 05:55:23 AM
      Parameters:
      dateTime - a LocalDateTime object
      Returns:
      formatted time
    • getVerboseDate

      public static java.lang.String getVerboseDate​(java.time.LocalDateTime dateTime)
      Returns the date in a verbose format Example: Tuesday, 31 December, 2021
      Parameters:
      dateTime - a LocalDateTime object
      Returns:
      formatted verbose date
    • getFormattedDate

      public static java.lang.String getFormattedDate​(java.time.LocalDateTime dateTime)
      Returns the date in a verbose format Example: 31/12/2021
      Parameters:
      dateTime - a LocalDateTime object
      Returns:
      formatted verbose date
    • getFormattedDateTime

      public static java.lang.String getFormattedDateTime​(java.time.LocalDateTime dateTime)
      Returns prettified date and time Example: 2021-09-15 11:38 PM
      Parameters:
      dateTime - a LocalDateTime object
      Returns:
      formatted concise date and time
    • getCurrentDateTime

      public static java.time.LocalDateTime getCurrentDateTime()
      Returns the current date and time in local time zone, based on the one that is set on the operating system
      Returns:
      LocalDateTime object