DateTime.format(value:int, format:string)
Name | Type | Действие | Значение по умолчанию |
---|---|---|---|
value | int | Time in Unix timestamp | — |
format | string | The template for the resulting date string. Can be one of the patterns listed in DateTime.Format or passed as a string |
— |
export class Main extends Indicator { constructor() { super(); } onInit() {} async onUpdate() { const PriceType = 0, {Time, Open} = await Bar.load([Bar.Mode.Time, Bar.Mode.Open], PriceType); let t = Time[0]; let ThisDate = DateTime.format(t, 'YYYY.MM.DD'); this.print('ThisDate is '+ThisDate); // result, for example: ThisDate is 2017.10.06 ThisDate = DateTime.format(t, 'YYYY/MM/DD'); this.print('ThisDate is '+ThisDate); // result, for example: ThisDate is 2017/10/06 ThisDate = DateTime.format(t, 'DD/MM/YYYY HH:mm'); this.print('ThisDate is '+ThisDate); // result, for example: ThisDate is 06/10/2017 17:56 ThisDate = DateTime.format(t, '"HH:mm:ss:SSS DD/MM/YYYY года"'); this.print('ThisDate is '+ThisDate); // result - time with seconds: milliseconds and date in the given form, for example: ThisDate is "22:33:44:777 06/10/2017 года" } }