• XbFormatDateTime(nDateTime[, cFormatString])


    • Description
      This function is used to convert the time/date integer (UTC-format) into an human
      readable format.

    • Parameter(s)

      nDateTime
      time/date integer (UTC-format)

      cFormatString
      Specifies the format of the returnd string
      The following placeholders and there returns:

      Value   Meaning
      %a locale's abbreviated weekday name
      %A locale's full weekday name
      %b locale's abbreviated month name
      %B locale's full month name
      %c locale's appropriate date and time representation
      %d day of the month as a decimal number (01-31)
      %D date in the format mm/dd/yy (POSIX)
      %h locale's abbreviated month name (POSIX)
      %H hour (24-hour clock) as a decimal number (00-23)
      %I hour (12-hour clock) as a decimal number (01-12)
      %j day of the year as a decimal number (001-366)
      %m month as a decimal number (01-12)
      %M minute as a decimal number (00-59)
      %n newline character (POSIX)
      %p locale's equivalent of either AM or PM
      %r  12-hour clock time (01-12) using the AM/PM notation in the format HH:MM:SS (AM|PM) (POSIX)
      %S second as a decimal number (00-59)
      %t tab character (POSIX)
      %T 24-hour clock time in the format HH:MM:SS (POSIX)
      %U week number of the year as a decimal number (00-52) where Sunday is the first day of the week
      %w weekday as a decimal number (0-6) where 0 is Sunday
      %W week number of the year as a decimal number (00-52) where Monday is the first day of the week
      %x locale's appropriate date representation
      %X locale's appropriate time representation
      %y year without century as a decimal number (00-99)
      %Y year with century as a decimal number
      %Z, %z
      timezone name, or by no characters if no timezone exists (%z is an extension to ANSI/POSIX)
      %% character %

       

    • Return Value
      If the function succeeds, the return value is from type character, otherwise NIL
    • Sample
      local nEvtHandle    := 0
      local cError             := space(100)
      local aEventArray
      local nFlag               := EVENTLOG_SEEK_READ+EVENTLOG_FORWARDS_READ

      //
      // open a Eventlog-Key
      //
      if ((nEvtHandle := XbOpenEventLog(, "WinApp")) <= 0)
        XbEventGetLastError(@cError)
        ? "Error :", cError
      else
        //
        // we will read the first entry
        //
        aEventArray := XbReadEventLog(nEvtHandle, nFlag, 1)
        if (ValType(aEventArray) == "A")
          ? XbFormatDateTime(aEventString[2], "%m/%d/%Y")   // e.g. "03/17/1966"
          ? XbFormatDateTime(aEventString[2], "%H:%M")         // e.g. "17:33"
          ? aEventString[8]
        endif

        XbCloseEventLog(nEvtHandle)
      endif