Transforming a date and time

In BizzStream date and time are following the ISO 8601 standard. BizzStream uses its own JavaScript methods to change dates and times from the database to match the ISO 8601 standard. ISO dates can be written with added hours, minutes, and seconds (YYYY-MM-DDTHH:MM:SSZ). Where date and time are seperated by a capital T, and UTC time is defined with a capital Z.

Transforming a date

A date is stored in the database as 2020-01-23 (YYYY-MM-DD).

myDate.toISODateString();

For example

//For example: Today's date is 28th September 2017
var myDate = new Date();

//The value of myDate = 2017-09-28T15:26:19.259Z
//I want to extract only the date using the toISODateString() method
var dateOnly = myDate.toISODateString();

//Now the value of dateOnly = 2017-09-28

Transforming time

A time is stored in the database as 15:26:19.259 (HH-MM-SS.SSS).

myDate.toISOTimeString();

For example

//For example: I want to get the current time in HH:MM
var myDate = new Date();

//The value of myDate = 2017-09-28T15:26:19.259Z
//I want to extract only the date using the toISOTimeString() method
var dateOnly = myDate.toISOTimeString();

//Now the value of dateOnly = 15:26

results matching ""

    No results matching ""