DateTimeUtils - 전역

  • 릴리스 버전: Xanadu
  • 업데이트 날짜 2024년 08월 01일
  • 읽기2분
  • DateTimeUtils 스크립트 포함은 날짜/시간 함수의 컬렉션입니다.

    이 스크립트 포함은 모든 서버 측 스크립트에서 사용할 수 있으며 GlideAjax를 통해 사용할 수 있습니다.

    DateTimeUtils - int8ToGlideDateTime(번호, int64)

    Microsoft AD integer8 DateTime 형식을 GlideDateTime 형식으로 변환합니다.

    Integer8은 Microsoft Filetime 형식이라고도 합니다. 이 방법은 일반적으로 만료 날짜와 같은 AD 사용자의 날짜 필드를 임포트할 때 사용됩니다.

    표 1. 매개변수
    이름 유형 설명
    int64 번호 1601년 1월 1일(UTC) 이후의 100나노초 간격 수를 나타내는 64비트 값입니다.
    표 2. 반환
    유형 설명
    GlideDateTime Integer8 날짜 및 시간으로 설정된 GlideDateTime 개체입니다.
    //convert and set account expiration date from AD
    //this is an example that could be used in an LDAP import transform map to import the LDAP account 
    //expires attribute to a customer created u_account_expires GlideDateTime field
    var dtUtil = new DateTimeUtils();
    target.u_account_expires = dtUtil.int8ToGlideDateTime(source.u_accountexpires);

    DateTimeUtils – msToGlideDateTime(밀리초 수)

    밀리초를 GlideDateTime 객체로 변환

    표 3. 매개변수
    이름 유형 설명
    밀리초 번호 밀리초 단위
    표 4. 반환
    유형 설명
    GlideDateTime GlideDateTime 객체
    //example script to call the method from a client
    Replace MILLISECONDSVALUE with your variable
    var ga = new GlideAjax('DateTimeUtils');
    ga.addParam('sysparm_name','msToGlideDateTime');
    ga.addParam('sysparm_value', MILLISECONDSVALUE);
    ga.getXMLWait();
    var newGDT = ga.getAnswer();