dateFormat (ChartObject method)

시간 값(밀리초)을 지정한 형식의 날짜 문자열로 변환합니다.
formatter 함수 안에서 x축이 시간(xAxis.type: "datetime")일 때 사용합니다.

Syntax

{ibchart}.dateFormat(format, timestamp);

Parameters

Name Type Required Description
format string 필수 형식 문자열
timestamp number 필수 시간 값 (밀리초)

Returns

string 변환된 문자열

Enum

Value Description
%Y 연도 4자리 (2025)
%y 연도 2자리 (25)
%m 월 2자리 (01)
%B 월 이름 (IBLANG의 months) (1월)
%b 월 약자 (shortMonths) (1)
%d 일 2자리 (05)
%e 일 (한 자리면 앞에 공백 한 칸) (5)
%A 요일 (weekdays) (일요일)
%a 요일 약자 (shortWeekdays) (일)
%w 요일 숫자 (일요일 0 ~ 토요일 6) (0)
%H 시 24시간 2자리 (14)
%k 시 24시간 (앞에 0 없음) (14)
%I 시 12시간 2자리 (02)
%l 시 12시간 (앞에 0 없음) (2)
%p AM/PM 표시 (대문자) (PM)
%P am/pm 표시 (소문자) (pm)
%M 분 2자리 (07)
%S 초 2자리 (09)
%L 밀리초 3자리 (045)

Example

myChart.dateFormat("%Y-%m-%d %H:%M", Date.UTC(2025, 0, 31, 9, 30));  // "2025-01-31 09:30"

// tooltip에서 사용
myChart.setOptions({
  xAxis: { type: "datetime" },
  tooltip: {
    formatter: function() {
      return myChart.dateFormat("%Y년 %m월 %d일", this.x) + "<br>" + this.y;
    }
  }
}, {append: true, redraw: true});

참고

Since

version desc
7.3.1.32