- TIBCO BusinessEvents®
- Standard
- DateTime

# DateTime

## Description

Utility Functions to Operate on DateTime Properties

## Functions

Name | Signature and Synopsis
--- | ---
`addDay` | `DateTime addDay (DateTime date, int days)` Adds a number of `days` to a `date` and returns the resulting DateTime. The `date` argument is not modified.
`addHour` | `DateTime addHour(DateTime date, int hours)` Adds a number of `hour` to a `date` and returns the resulting DateTime. The `date` argument is not modified.
`addMinute` | `DateTime addMinute (DateTime date, int minutes)` Adds a number of `minutes` to a `date` and returns the resulting DateTime. The `date` argument is not modified.
`addMonth` | `DateTime addMonth (DateTime date, int months)` Adds a number of `months` to a `date` and returns the resulting DateTime. The `date` argument is not modified.
`addSecond` | `DateTime addSecond (DateTime date, int seconds)` Adds a number of `seconds` to a `date` and returns the resulting DateTime. The `date` argument is not modified.
`addWeek` | `DateTime addWeek (DateTime date, int weeks)` Adds a number of `weeks` to a `date` and returns the resulting DateTime. The `date` argument is not modified.
`addYear` | `DateTime addYear (DateTime date, int years)` Adds a number of `years` to a `date` and returns the resulting DateTime. The `date` argument is not modified.
`after` | `boolean after (DateTime d1, DateTime d2)` Test if the first DateTime passed come `after` the second DateTime passed.
`before` | `boolean before (DateTime d1, DateTime d2)` Test if the first DateTime passed come before the second DateTime passed.
`createTime` | `DateTime createTime(int year, int month, int date, int hrs, int min, int sec, String tz)` Create a DateTime object of a particular timezone.
`equals` | `boolean equals (DateTime d1, DateTime d2)` Is the date time value of first DateTime passed same as date time value of second DateTime passed.
`format` | `String format (DateTime d1, String format)`
`getDate` | `int getDate(DateTime date)` Gets the date on the DateTime Object passed as input.
`getHour` | `int getHour(DateTime date)` Gets the hour on the DateTime Object passed as input.
`getMinute` | `int getMinute(DateTime date)` Gets the minute on the DateTime Object passed as input.
`getMonth` | `int getMonth(DateTime date)` Gets the month on the DateTime Object passed as input. Month value is 0-based. i.e. 0 for January, 11 for December.
`getSecond` | `int getSecond(DateTime date)` Gets the second on the DateTime Object passed as input.
`getTimeInMillis` | `long getTimeInMillis (DateTime date)` Returns the time in milliseconds since the start of 1970 GMT.
`getTimeZone` | `String getTimeZone(DateTime date, boolean daylight_saving_name)` Gets timezone id from DateTime object.
`getYear` | `int getYear(DateTime date)` Gets the year on the DateTime Object passed as input.
`notEquals` | `boolean notEquals (DateTime d1, DateTime d2)`
`now` | `DateTime now ()` Returns the current System time as a DateTime.
`parseLong` | `DateTime parseLong(long time)` Parses the time in milliseconds since the start of 1970 and return as a DateTime.
`parseString` | `DateTime parseString (String date, String format)` Parses the `date` provided in the string according to the format and returns it as a DateTime with default time zone.
`parseStringWithTimeZone` | `DateTime parseStringWithTimeZone (String date, String format)`
`translateTime` | `DateTime translateTime(DateTime date, String tz)` translate a time to a new timezone and return the new translated DateTime object