You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 38 Next »

This class provides methods for performing operations on SimpleDateTime objects, such as instantiating objects, for example.

You can also use this class to perform date-time operations, such as calculations, formatting or converting between date-time formats.

МетодОписание метода
setValue(dateTime)

Описание: Устанавливает дату и время объекта SimpleDateTime.

Принимает:

  •  - A string in the UTC time zone and the internal format of yyyy-MM-dd HH:mm:ss.
  • - A Simple DateTime object
  • - A JavaScript Number. Sets the value of the object using the Number value as milliseconds past January 1, 1970 00:00:00 GMT.

Возвращает: Ничего.

Example:

var first_simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");
first_simple_date_time.setValue("2020-01-01 12:00:00");
ss.info( first_simple_date_time.getValue() );  // 2020-01-01 12:00:00


subtract(first, second)

Описание:Отнимает от текущего времени либо возвращает разницу между переданными объектами SimpleDateTime.

Принимает:

  • SimpleDateTime Object
  • SimpleTime Object
  • Number milliseconds

Возвращает: объект SimpleDuration

Example:

var simple_date_time = new SimpleDateTime("2019-01-01 08:00:00");

var simple_time = new SimpleTime();
simple_time.setValue("00:00:20");

simple_date_time.subtract(simple_time);

var second_simple_time  = simple_date_time.getTime();
ss.info( second_simple_time.getByFormat('h:m:s') ); // 2019-01-01 07:59:40

  • No labels