Show TOC

Background documentationApplet Date and Time Methods

 

The following table lists methods for SAP Manufacturing Integration and Intelligence date and time formatting and date math:

Name

Use

Double dateDiff(String sDate1, String sDate2)

Takes two XML date strings and returns the difference between them in seconds. A negative number indicates that sDate2 is before sDate1.

Double dateDiffFormatted(String sDate1, String sDate2, String sFormat)

Takes two date strings in the provided format string and returns the difference between them in seconds. A negative number indicates that sDate2 is before sDate1.

String dateAdd(String sourceDate, String dateFormat, String sUnits, int nUnits)

Takes the date string with its corresponding format and adds the desired units. A negative nUnits number does the equivalent of a date subtraction.

Double dateToSeconds(String sDate1)

Takes an XML date and converts it to seconds.

Double dateToSecondsFormatted(String sDate1, String sFormat)

Takes a date in the user-defined format and converts it to seconds.

String dateFromSeconds(double dSeconds)

Takes seconds and returns the corresponding date in XML.

String dateFromSecondsFormatted(double dSeconds, String sFormat)

Takes seconds and returns the corresponding date in the desired format.

String dateNow()

Returns the current date and time in XML format, such as yyyy-MM-ddThh:mm:ss. For example, using the above format, the system could return the following date and time: 2010-09-23T08:30:00.

String dateNowFormatted(String sFormatTo)

Returns the current date and time in the requested format. For example, the format MM/dd/yyyy HH:mm:ss returns 09/23/2004 08:30:00.

String dateToXMLFormat(String sDate1, String sFormatFrom)

Takes the date string with the corresponding format and converts it to the XML date format.

String dateFromXMLFormat(String sDate1, String sFormatTo)

Takes the XML date string and converts it to the desired format.