Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 | 2x 9x 18x | /**
* A helper class to generate formatted date strings
* @hideconstructor
*/
export class DateTimeHelper {
/**
* Create a timestamp string in the following format for a given date: yyyymmdd'T'HHMMss
* @param {Date} date - The date for which we want to create the formatted string
*/
public static GetTimestampString(date:Date) {
return `${this.GetDateString(date)}T${date.getUTCHours().toString().padStart(2,'0')}${date.getUTCMinutes().toString().padStart(2,'0')}${date.getUTCSeconds().toString().padStart(2,'0')}`;
}
/**
* Create a date string in the following format for a given date: yyyymmdd
* @param {Date} date - The date for which we want to create the formatted string
*/
public static GetDateString(date:Date) {
return `${date.getUTCFullYear().toString().padStart(4,'0')}${(date.getUTCMonth() + 1).toString().padStart(2,'0')}${date.getUTCDate().toString().padStart(2,'0')}`;
}
} |