Package com.deco2800.game.utils
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.LocalDateTimegetCurrentDateTime()Returns the current date and time in local time zone, based on the one that is set on the operating systemstatic java.lang.StringgetFormattedDate(java.time.LocalDateTime dateTime)Returns the date in a verbose format Example: 31/12/2021static java.lang.StringgetFormattedDateTime(java.time.LocalDateTime dateTime)Returns prettified date and time Example: 2021-09-15 11:38 PMstatic java.lang.StringgetFormattedTime(java.time.LocalDateTime dateTime)Prettifies the time and returns it Example: 05:55:23 AMstatic java.lang.StringgetVerboseDate(java.time.LocalDateTime dateTime)Returns the date in a verbose format Example: Tuesday, 31 December, 2021
-
Constructor Details
-
DateTimeUtils
public DateTimeUtils()
-
-
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
-