Function datetozulu

  • Date object to zulu time string

    Parameters

    • d: Date

      Date object for specified time

    • flagUTCTime: boolean = false

      if this is true year will be YY otherwise YYYY

    • flagMilli: boolean = false

      if this is true result concludes milliseconds

    Returns string

    GeneralizedTime or UTCTime string (ex. 20170412235959.384Z)

    Description

    This function converts from Date object to GeneralizedTime string (i.e. YYYYMMDDHHmmSSZ) or UTCTime string (i.e. YYMMDDHHmmSSZ). As for UTCTime, if year "YY" is equal or less than 49 then it is 20YY. If year "YY" is equal or greater than 50 then it is 19YY. If flagMilli is true its result concludes milliseconds such like "20170520235959.42Z".

    Example

    d = new Date(Date.UTC(2017,4,20,23,59,59,670));
    datetozulu(d) -> "20170520235959Z"
    datetozulu(d, true) -> "170520235959Z"
    datetozulu(d, false, true) -> "20170520235959.67Z"