Skip to content

Commit

Permalink
Add comments and fix naming warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
lulunac27a committed Jul 25, 2024
1 parent 8063ef4 commit a8f00e6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.lulunac27a.datetimethymeleaf.entity;

public class DateTime {// class with date and time information
public class DateTime {//class with date and time information with milliseconds, microseconds and nanoseconds
private int year;
private int month;
private int day;
Expand All @@ -10,77 +10,60 @@ public class DateTime {// class with date and time information
private int millisecond;
private int microsecond;
private int nanosecond;

//get getter and setter values for all fields
public int getYear() {
return year;
}

public void setYear(int year) {
this.year = year;
}

public int getMonth() {
return month;
}

public void setMonth(int month) {
this.month = month;
}

public int getDay() {
return day;
}

public void setDay(int day) {
this.day = day;
}

public int getHour() {
return hour;
}

public void setHour(int hour) {
this.hour = hour;
}

public int getMinute() {
return minute;
}

public void setMinute(int minute) {
this.minute = minute;
}

public int getSecond() {
return second;
}

public void setSecond(int second) {
this.second = second;
}

public int getMillisecond() {
return millisecond;
}

public void setMillisecond(int millisecond) {
this.millisecond = millisecond;
}

public int getMicrosecond() {
return microsecond;
}

public void setMicrosecond(int microsecond) {
this.microsecond = microsecond;
}

public int getNanosecond() {
return nanosecond;
}

public void setNanosecond(int nanosecond) {
this.nanosecond = nanosecond;
}

}
10 changes: 5 additions & 5 deletions datetime.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ public static void main(String[] args) {
int year, month, day, hour, minute, second, millisecond, microsecond, nanosecond;// initialize date and time
// variables
DateTimeFormatter era1 = DateTimeFormatter.ofPattern("GGG"); // Format the date and time values with a
// specified pattern
// specified pattern for all supported formats
DateTimeFormatter era2 = DateTimeFormatter.ofPattern("GGGG");
DateTimeFormatter era3 = DateTimeFormatter.ofPattern("GGGGG");
DateTimeFormatter year1 = DateTimeFormatter.ofPattern("uu");
Expand Down Expand Up @@ -43,7 +43,7 @@ public static void main(String[] args) {
DateTimeFormatter localWeekOfMonth = DateTimeFormatter.ofPattern("F");
DateTimeFormatter amPm = DateTimeFormatter.ofPattern("a");
DateTimeFormatter hour12 = DateTimeFormatter.ofPattern("h");
DateTimeFormatter hour0_11 = DateTimeFormatter.ofPattern("K");
DateTimeFormatter hour0To11 = DateTimeFormatter.ofPattern("K");
DateTimeFormatter hour24 = DateTimeFormatter.ofPattern("k");
DateTimeFormatter hourOfDay = DateTimeFormatter.ofPattern("H");
DateTimeFormatter minute1 = DateTimeFormatter.ofPattern("m");
Expand Down Expand Up @@ -130,7 +130,7 @@ public static void main(String[] args) {
System.out.println("Local Week of Month: " + localWeekOfMonth.format(enteredDateAndTime));
System.out.println("AM/PM: " + amPm.format(enteredDateAndTime));
System.out.println("12 Hour Format " + hour12.format(enteredDateAndTime));
System.out.println("0-11 Hour Format: " + hour0_11.format(enteredDateAndTime));
System.out.println("0-11 Hour Format: " + hour0To11.format(enteredDateAndTime));
System.out.println("24 Hour Format: " + hour24.format(enteredDateAndTime));
System.out.println("Hour of Day: " + hourOfDay.format(enteredDateAndTime));
System.out.println("Minute: " + minute1.format(enteredDateAndTime));
Expand Down Expand Up @@ -183,7 +183,7 @@ public static void main(String[] args) {
System.out.println("Current Local Week of Month: " + localWeekOfMonth.format(dateAndTimeNow));
System.out.println("Current AM/PM: " + amPm.format(dateAndTimeNow));
System.out.println("Current 12 Hour Format " + hour12.format(dateAndTimeNow));
System.out.println("Current 0-11 Hour Format: " + hour0_11.format(dateAndTimeNow));
System.out.println("Current 0-11 Hour Format: " + hour0To11.format(dateAndTimeNow));
System.out.println("Current 24 Hour Format: " + hour24.format(dateAndTimeNow));
System.out.println("Current Hour of Day: " + hourOfDay.format(dateAndTimeNow));
System.out.println("Current Minute: " + minute1.format(dateAndTimeNow));
Expand Down Expand Up @@ -240,7 +240,7 @@ public static void main(String[] args) {
System.out.println("Current UTC Local Week of Month: " + localWeekOfMonth.format(utcDateAndTimeNow));
System.out.println("Current UTC AM/PM: " + amPm.format(utcDateAndTimeNow));
System.out.println("Current UTC 12 Hour Format " + hour12.format(utcDateAndTimeNow));
System.out.println("Current UTC 0-11 Hour Format: " + hour0_11.format(utcDateAndTimeNow));
System.out.println("Current UTC 0-11 Hour Format: " + hour0To11.format(utcDateAndTimeNow));
System.out.println("Current UTC 24 Hour Format: " + hour24.format(utcDateAndTimeNow));
System.out.println("Current UTC Hour of Day: " + hourOfDay.format(utcDateAndTimeNow));
System.out.println("Current UTC Minute: " + minute1.format(utcDateAndTimeNow));
Expand Down

0 comments on commit a8f00e6

Please sign in to comment.