@Override public ChangeItemBean createAttachment(final File file, final String filename, final String contentType, @Nullable final ApplicationUser remoteUser, final GenericValue issue) throws AttachmentException { return createAttachment(file, filename, contentType, remoteUser, issue, Collections.<String, Object>emptyMap(), nowTimestamp()); }
public static java.sql.Timestamp getDayEnd(java.sql.Timestamp stamp) { return getDayEnd(stamp, 0); }
public static java.sql.Timestamp getNextDayStart(java.sql.Timestamp stamp) { return getDayStart(stamp, 1); }
/** Makes a combined data and time string in the format "MM/DD/YYYY HH:MM:SS" from a Date. If the seconds are 0 they are left off. * @param date The Date * @return A combined data and time string in the format "MM/DD/YYYY HH:MM:SS" where the seconds are left off if they are 0. */ public static String toDateTimeString(java.util.Date date) { if (date == null) return ""; String dateString = toDateString(date); String timeString = toTimeString(date); if (dateString != null && timeString != null) return dateString + " " + timeString; else return ""; }
/** Converts a time String into a java.sql.Time * @param time The time String: either HH:MM or HH:MM:SS * @return A java.sql.Time made from the time String */ public static java.sql.Time toSqlTime(String time) { java.util.Date newDate = toDate("1/1/1970", time); if (newDate != null) return new java.sql.Time(newDate.getTime()); else return null; }
/** Makes a time String in the format HH:MM:SS from a Date. If the seconds are 0, then the output is in HH:MM. * @param date The Date * @return A time String in the format HH:MM:SS or HH:MM */ public static String toTimeString(java.util.Date date) { if (date == null) return ""; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return (toTimeString(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND))); }
/** Converts a time String into a java.sql.Time * @param time The time String: either HH:MM or HH:MM:SS * @return A java.sql.Time made from the time String */ public static java.sql.Time toSqlTime(String time) { java.util.Date newDate = toDate("1/1/1970", time); if (newDate != null) return new java.sql.Time(newDate.getTime()); else return null; }
/** Makes a combined data and time string in the format "MM/DD/YYYY HH:MM:SS" from a Date. If the seconds are 0 they are left off. * @param date The Date * @return A combined data and time string in the format "MM/DD/YYYY HH:MM:SS" where the seconds are left off if they are 0. */ public static String toDateTimeString(java.util.Date date) { if (date == null) return ""; String dateString = toDateString(date); String timeString = toTimeString(date); if (dateString != null && timeString != null) return dateString + " " + timeString; else return ""; }
/** Makes a time String in the format HH:MM:SS from a Date. If the seconds are 0, then the output is in HH:MM. * @param date The Date * @return A time String in the format HH:MM:SS or HH:MM */ public static String toTimeString(java.util.Date date) { if (date == null) return ""; Calendar calendar = Calendar.getInstance(); calendar.setTime(date); return (toTimeString(calendar.get(Calendar.HOUR_OF_DAY), calendar.get(Calendar.MINUTE), calendar.get(Calendar.SECOND))); }
@Override public ChangeItemBean createAttachment(final File file, final String filename, final String contentType, @Nullable final ApplicationUser remoteUser, final Issue issue) throws AttachmentException { return createAttachment(file, filename, contentType, remoteUser, issue, Collections.<String, Object>emptyMap(), nowTimestamp()); }
/** Converts a date String and a time String into a Timestamp * @param date The date String: MM/DD/YYYY * @param time The time String: either HH:MM or HH:MM:SS * @return A Timestamp made from the date and time Strings */ public static java.sql.Timestamp toTimestamp(String date, String time) { java.util.Date newDate = toDate(date, time); if (newDate != null) return new java.sql.Timestamp(newDate.getTime()); else return null; }
public static java.sql.Timestamp getDayStart(java.sql.Timestamp stamp) { return getDayStart(stamp, 0); }
public static java.sql.Timestamp getDayEnd(java.sql.Timestamp stamp) { return getDayEnd(stamp, 0); }
/** *returns the values that are currently active. * *@param datedValues GenericValue's that have "fromDate" and "thruDate" fields *@param allAreSame Specifies whether all values in the List are of the same entity; this can help speed things up a fair amount since we only have to see if the from and thru date fields are valid once *@return List of GenericValue's that are currently active */ public static List filterByDate(List datedValues, boolean allAreSame) { return filterByDate(datedValues, UtilDateTime.nowTimestamp(), "fromDate", "thruDate", allAreSame); }
/** Converts a date String into a java.sql.Date * @param date The date String: MM/DD/YYYY * @return A java.sql.Date made from the date String */ public static java.sql.Date toSqlDate(String date) { java.util.Date newDate = toDate(date, "00:00:00"); if (newDate != null) return new java.sql.Date(newDate.getTime()); else return null; }
public static java.sql.Timestamp getDayStart(java.sql.Timestamp stamp) { return getDayStart(stamp, 0); }
/** * returns the values that are currently active. * * @param datedValues GenericValue's that have "fromDate" and "thruDate" fields * @param allAreSame Specifies whether all values in the List are of the same entity; this can help speed things up a fair amount since we only have to see if the from and thru date fields are valid once * @return List of GenericValue's that are currently active */ public static <T extends GenericEntity> List<T> filterByDate(List<T> datedValues, boolean allAreSame) { return filterByDate(datedValues, UtilDateTime.nowTimestamp(), "fromDate", "thruDate", allAreSame); }
/** Converts a date String into a java.sql.Date * @param date The date String: MM/DD/YYYY * @return A java.sql.Date made from the date String */ public static java.sql.Date toSqlDate(String date) { java.util.Date newDate = toDate(date, "00:00:00"); if (newDate != null) return new java.sql.Date(newDate.getTime()); else return null; }