Object DateHelper

  • All Implemented Interfaces:

    
    public class DateHelper
    
                        
    • Constructor Detail

    • Method Detail

      • toISOString

         final String toISOString(Date date)

        Convert a date to an ISO string in UTC

        Parameters:
        date - to format as Date - nullable
      • fromISOString

         final Date fromISOString(String date)

        Get a date from an ISO string with fixed timezone (Z)

        Parameters:
        date - to parse as String - nullable
      • getGMTTimestamp

         final String getGMTTimestamp(Long timeInMs)

        Convert a timestamp that can be used in request headers

        Parameters:
        timeInMs - the timestamp to format
      • getDurationLabel

         final String getDurationLabel(LanguagesHelper languagesHelper, Long unitCount, String unitKey, Boolean formatBigNumber)

        Displays duration of time units in human readable format. Unit keys are "year", "month", "day", "hour", "minute", "second".

        Parameters:
        languagesHelper - languagesHelper used to get locale-dependant resources
        unitCount - count of to display
        unitKey - key for this unit
        formatBigNumber - whether big number should be formatted according to user language
      • getDurationLabelWithSecondsIfNeeded

         final String getDurationLabelWithSecondsIfNeeded(LanguagesHelper languagesHelper, Long durationInSeconds)

        Convert duration in seconds into a displayable, human readable approximation of the duration, together with the exact value in seconds if duration is more than 1 minute

        Parameters:
        languagesHelper - languagesHelper used to get locale-dependant resources
        durationInSeconds - the duration in seconds