Package com.swiftmq.impl.streams
Class TimeSupport
java.lang.Object
com.swiftmq.impl.streams.TimeSupport
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
-
Method Summary
Modifier and TypeMethodDescriptionlong
Returns the current System timeint
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.Formats the time according to the pattern.int
hour()
Returns the hour of the current time.int
hour
(long time, int offset) Returns the hour from the time+offset.int
minute()
Returns the minute of the current time.int
minute
(long time, int offset) Returns the minute from the time+offset.int
month()
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
Parses a formatted date/time string and returns the time in milliseconds.int
second()
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
week()
Returns the week of the current time.int
week
(long time, int offset) Returns the week from the time+offset.int
year()
Returns the year of the current time.int
year
(long time, int offset) Returns the year from the time+offset.
-
Constructor Details
-
TimeSupport
public TimeSupport()
-
-
Method Details
-
currentTime
public long currentTime()Returns the current System time- Returns:
- system time
-
format
Formats the time according to the pattern.- Parameters:
time
- timepattern
- pattern (see SimpleDateFormat)- Returns:
- formatted time
-
parse
Parses a formatted date/time string and returns the time in milliseconds.- Parameters:
datetime
- formatted date/time stringpattern
- 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
- timeoffset
- 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
- timeoffset
- 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
- timeoffset
- 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
- timeoffset
- 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
- timeoffset
- 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
- timeoffset
- 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
- timeoffset
- 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
- timeoffset
- offset- Returns:
- start of day in milliseconds
-
dayDisplayName
Returns the display name of the day (e.g. "Tuesday") from the time+offset. Offset can be positive or negative.- Parameters:
time
- timeoffset
- offset- Returns:
- day display name
-
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
- timeoffset
- 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
- timeoffset
- 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
- timeoffset
- 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
- timeoffset
- offset- Returns:
- start of month in milliseconds
-
monthDisplayName
Returns the display name of the month (e.g. "February") from the time+offset. Offset can be positive or negative.- Parameters:
time
- timeoffset
- offset- Returns:
- month display name
-
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
- timeoffset
- 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
- timeoffset
- offset- Returns:
- start of year in milliseconds
-