DateTime

Deprecation Warning! The content below is only applicable for use within deprecated 1.x versions of CA Agile Central's App SDK. Use of the component(s) and/or code on this page is not supported. To develop custom apps within our current environments, please see App SDK 2.0 documentation.

The rally.sdk.util.DateTime object provides methods for manipulating and formatting dates.

Static Methods

Method Name Parameters Description Example
add date*, unit*, amount* Returns the date which results from adding the specified unit amount to the specified date.
The unit should be one of the following: year, month, week, day, hour, minute, second, millisecond.
The amount may be positive of negative.
rally.sdk.util.DateTime.add
(new Date(), "week", 2);
getDifference date1*, date2*, unit* Returns the difference between date1 and date2 calculated in the specified unit.
The unit should be one of the following: year, month, week, day, hour, minute, second, millisecond.
rally.sdk.util.DateTime.
getDifference(new Date(2011, 5, 26),
new Date(2011, 5, 25), "day");
format date*, format* Returns a string representation of the specified date as specified by the format string.
Format tokens:
y = year
M = month
w = week of year
d = date
D = day of year
E = day of the week
a = am/pm
h = hours (0-11)
H = hours (0-23)
m = minutes
s = seconds
S = milliseconds
rally.sdk.util.DateTime.
format(new Date(), "yyyy-MM-dd");
fromIsoString dateString*, adjustToLocalTime Returns a date object parsed from the specified ISO-8601 UTC string.
If adjustToLocalTime is true, the date will be adjusted to the browser's local time zone.
(Default is false).
rally.sdk.util.DateTime.
fromIsoString("2011-05-25T12:05:00Z", true);
toIsoString date*, adjustFromLocalTime Returns an ISO-8601 UTC string.
If adjustFromLocalTime is true, the date will be adjusted from the browser's local time zone.
(Default is false).
rally.sdk.util.DateTime.
toIsoString(new Date());

* = required parameter

反馈

需要更多帮助? CA Agile Central 社区为您提供一站式自助和支持。要将反馈或支持请求提交到 CA Agile Central 支持、获取解答并与其他用户协作,请加入我们的 CA Agile Central 社区