Class TimeSupport

java.lang.Object
com.swiftmq.impl.streams.TimeSupport

public class TimeSupport extends Object
Convenience class that provides various time methods. It is accessible from Streams scripts via variable "time".
Author:
IIT Software GmbH, Muenster/Germany, (c) 2017, All Rights Reserved
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Returns the current System time
    int
    day()
    Returns the day of the current time.
    int
    day(long time, int offset)
    Returns the day from the time+offset.
    Returns the display name of the day (e.g.
    dayDisplayName(long time, int offset)
    Returns the display name of the day (e.g.
    format(long time, String pattern)
    Formats the time according to the pattern.
    int
    Returns the hour of the current time.
    int
    hour(long time, int offset)
    Returns the hour from the time+offset.
    int
    Returns the minute of the current time.
    int
    minute(long time, int offset)
    Returns the minute from the time+offset.
    int
    Returns the month of the current time.
    int
    month(long time, int offset)
    Returns the month from the time+offset.
    Returns the display name of the month (e.g.
    monthDisplayName(long time, int offset)
    Returns the display name of the month (e.g.
    long
    parse(String datetime, String pattern)
    Parses a formatted date/time string and returns the time in milliseconds.
    int
    Returns the seconds of the current time.
    int
    second(long time, int offset)
    Returns the seconds from the time+offset.
    long
    startOfDay(long time, int offset)
    Returns the start of the day from time+offset.
    long
    startOfHour(long time, int offset)
    Returns the start of the hour from time+offset.
    long
    startOfMinute(long time, int offset)
    Returns the start of the minute from time+offset.
    long
    startOfMonth(long time, int offset)
    Returns the start of the month from time+offset.
    long
    startOfSecond(long time, int offset)
    Returns the start of the second from time+offset.
    long
    startOfWeek(long time, int offset)
    Returns the start of the week from time+offset.
    long
    startOfYear(long time, int offset)
    Returns the start of the year from time+offset.
    int
    Returns the week of the current time.
    int
    week(long time, int offset)
    Returns the week from the time+offset.
    int
    Returns the year of the current time.
    int
    year(long time, int offset)
    Returns the year from the time+offset.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • TimeSupport

      public TimeSupport()
  • Method Details

    • currentTime

      public long currentTime()
      Returns the current System time
      Returns:
      system time
    • format

      public String format(long time, String pattern)
      Formats the time according to the pattern.
      Parameters:
      time - time
      pattern - pattern (see SimpleDateFormat)
      Returns:
      formatted time
    • parse

      public long parse(String datetime, String pattern) throws Exception
      Parses a formatted date/time string and returns the time in milliseconds.
      Parameters:
      datetime - formatted date/time string
      pattern - pattern (see SimpleDateFormat)
      Returns:
      time in millis
      Throws:
      Exception
    • second

      public int second(long time, int offset)
      Returns the seconds from the time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      seconds
    • second

      public int second()
      Returns the seconds of the current time.
      Returns:
      seconds
    • startOfSecond

      public long startOfSecond(long time, int offset)
      Returns the start of the second from time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      start of seconds in milliseconds
    • minute

      public int minute(long time, int offset)
      Returns the minute from the time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      minute
    • minute

      public int minute()
      Returns the minute of the current time.
      Returns:
      minute
    • startOfMinute

      public long startOfMinute(long time, int offset)
      Returns the start of the minute from time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      start of minute in milliseconds
    • hour

      public int hour(long time, int offset)
      Returns the hour from the time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      hour
    • hour

      public int hour()
      Returns the hour of the current time.
      Returns:
      hour
    • startOfHour

      public long startOfHour(long time, int offset)
      Returns the start of the hour from time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      start of hour in milliseconds
    • day

      public int day(long time, int offset)
      Returns the day from the time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      day
    • day

      public int day()
      Returns the day of the current time.
      Returns:
      day
    • startOfDay

      public long startOfDay(long time, int offset)
      Returns the start of the day from time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      start of day in milliseconds
    • dayDisplayName

      public String dayDisplayName(long time, int offset)
      Returns the display name of the day (e.g. "Tuesday") from the time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      day display name
    • dayDisplayName

      public String dayDisplayName()
      Returns the display name of the day (e.g. "Tuesday") of the current time.
      Returns:
      day display name
    • week

      public int week(long time, int offset)
      Returns the week from the time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      week
    • week

      public int week()
      Returns the week of the current time.
      Returns:
      week
    • startOfWeek

      public long startOfWeek(long time, int offset)
      Returns the start of the week from time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      start of week in milliseconds
    • month

      public int month(long time, int offset)
      Returns the month from the time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      month
    • month

      public int month()
      Returns the month of the current time.
      Returns:
      month
    • startOfMonth

      public long startOfMonth(long time, int offset)
      Returns the start of the month from time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      start of month in milliseconds
    • monthDisplayName

      public String monthDisplayName(long time, int offset)
      Returns the display name of the month (e.g. "February") from the time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      month display name
    • monthDisplayName

      public String monthDisplayName()
      Returns the display name of the month (e.g. "February") of the current time.
      Returns:
      month display name
    • year

      public int year(long time, int offset)
      Returns the year from the time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      year
    • year

      public int year()
      Returns the year of the current time.
      Returns:
      year
    • startOfYear

      public long startOfYear(long time, int offset)
      Returns the start of the year from time+offset. Offset can be positive or negative.
      Parameters:
      time - time
      offset - offset
      Returns:
      start of year in milliseconds