Skip to content

Commit

Permalink
New DateTime method for formatting dates
Browse files Browse the repository at this point in the history
  • Loading branch information
blakemcbride committed Jun 13, 2024
1 parent 5caa257 commit d1c7d31
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion src/main/core/org/kissweb/DateTime.java
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ public ZonedDateTime getZonedDateTime() {
}

/**
* Return the date formatted as mm/dd/yyyy hh:mm AM/PM
* Return the current date formatted as mm/dd/yyyy hh:mm AM/PM
*
* @return
*/
Expand Down Expand Up @@ -206,6 +206,22 @@ public static String format(Date date) {
return df.format(date);
}

/**
* Format a date passed into a string formatted as determined by <code>fmt</code>
*
* @param date
* @param fmt
* @return
*
* @see java.text.SimpleDateFormat for information about fmt
*/
public static String format(Date date, String fmt) {
if (date == null)
return "";
SimpleDateFormat df = new SimpleDateFormat(fmt);
return df.format(date);
}

/**
* Format a date passed into a string mm/dd/yyyy hh:mm AM/PM xST
*
Expand Down

0 comments on commit d1c7d31

Please sign in to comment.