Package src.model
Class DateTime
Object
DateTime
- All Implemented Interfaces:
Serializable
The Class that handles the data of Date and Time
- Version:
- 1.0
- Author:
- Jonathan Ng
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic int
Gets the current datestatic int
Gets the current daystatic int
Gets the current monthstatic int
Gets the current yearint
getDate()
Gets the date of the Dateint
getDay()
Gets the Day of the DateFormats a string of the holiday date timeint
getHour()
Gets the hour of the Timeint
Gets the minute of the Timeint
getMonth()
Gets the Month of the DateFormats a string of the current timeint
getYear()
Gets the Year of the Datevoid
Method to print out the date and the time
-
Constructor Details
-
DateTime
public DateTime(int minute, int hour, int day, int date, int month, int year) Constructor for DateTime class- Parameters:
minute
- is the minute of the Timehour
- is the hour of the Timeday
- is the day of the Date (1. Sunday 2. Monday 3. Tuesday 4. Wednesday 5. Thursday 6. Friday 7. Saturday)date
- is the date of the Datemonth
- is the month of the Dateyear
- is the year of the Date
-
DateTime
public DateTime()Constructor for DateTime class
-
-
Method Details
-
getMinute
public int getMinute()Gets the minute of the Time- Returns:
- Minute of the Time
-
getHour
public int getHour()Gets the hour of the Time- Returns:
- Hour of the Time
-
getDate
public int getDate()Gets the date of the Date- Returns:
- Date of the Date
-
getDay
public int getDay()Gets the Day of the Date- Returns:
- Day of the Date
-
getMonth
public int getMonth()Gets the Month of the Date- Returns:
- Month of the Date
-
getYear
public int getYear()Gets the Year of the Date- Returns:
- Year of the Date
-
printTime
public void printTime()Method to print out the date and the time -
getTimeNow
Formats a string of the current time- Returns:
- String of the current time
-
getHolidayTimeNow
Formats a string of the holiday date time- Returns:
- String of the current holiday date time
-
getCurrentYear
public static int getCurrentYear()Gets the current year- Returns:
- Year of the current year
-
getCurrentMonth
public static int getCurrentMonth()Gets the current month- Returns:
- Month of the current month
-
getCurrentDay
public static int getCurrentDay()Gets the current day- Returns:
- Day of the current Day
-
getCurrentDate
public static int getCurrentDate()Gets the current date- Returns:
- Date of the current date
-