날짜 함수 date-functions

날짜 함수를 사용하면 여정 표현식 내에서 날짜 및 시간 값을 조작하고 작업할 수 있습니다. 이러한 함수는 고객 여정에서 시간 기반 조건, 예약 및 임시 계산에 필수적입니다.

다음을 수행해야 하는 경우 날짜 함수 사용:

날짜 함수를 사용하면 시간 논리를 정확하게 제어할 수 있으므로 특정 시간대 및 일정에 응답하는 시간 구분 여정 경로 및 조건을 만들 수 있습니다.

NOTE
이 페이지의 함수는 여정 표현식에서 사용할 수 있습니다. now()과(와) 같은 일부 함수는 전자 메일 콘텐츠의 개인화 편집기에서 사용할 수 없습니다. 자세히 알아보기

currentTimeInMillis currentTimeInMillis

에포크 밀리초로 현재 시간을 반환합니다.

구문
currentTimeInMillis()
매개변수
이 함수는 매개 변수를 사용하지 않습니다.
서명 및 반환된 유형

currentTimeInMillis()

정수 반환.

예시

currentTimeInMillis()

"1544712617131"를 반환합니다.

dateDiff dateDiff

동일한 유형의 두 날짜 또는 날짜-시간 간의 차이를 반환합니다. 결과의 단위는 매개 변수 유형에 따라 다릅니다. dateOnly 매개 변수는 ​에 차이를 반환하는 반면 dateTimeOnlydateTime 매개 변수는 밀리초​에 차이를 반환합니다. 매개 변수가 null인 경우 null을(를) 반환합니다.

NOTE
개인화 편집기에서 사용할 수 있는 dateDiff과(와) 다른 함수입니다. 개인화 편집기 버전은 dateTime개의 매개 변수만 허용하고 항상 일 차이를 반환합니다.
구문
dateDiff(<date1>,<date2>)
매개변수
table 0-row-2 1-row-2 2-row-2
매개 변수 유형
날짜 1 dateOnly, dateTimeOnly 또는 dateTime
날짜 2 dateOnly, dateTimeOnly 또는 dateTime

두 매개 변수 모두 동일한 데이터 형식을 사용해야 합니다. 혼합 형식(예: dateOnly과(와) dateTime)은 지원되지 않습니다. 매개 변수는 리터럴 날짜 값, now()과(와) 같은 다른 함수 또는 컨텍스트 특성(이벤트 페이로드 필드, 사용자 지정 작업 응답 필드, 프로필 또는 엔터티 필드 및 변수)일 수 있습니다. 단, dateOnly, dateTimeOnly 또는 dateTime(으)로 형식화되어야 합니다.

서명 및 반환된 유형

dateDiff(<dateOnly>,<dateOnly>)

두 날짜 사이의 일 수를 나타내는 정수를 반환합니다.

dateDiff(<dateTimeOnly>,<dateTimeOnly>)

두 날짜-시간 사이의 밀리초 수를 나타내는 정수를 반환합니다.

dateDiff(<dateTime>,<dateTime>)

두 날짜-시간 사이의 밀리초 수를 나타내는 정수를 반환합니다.

dateDiff(toDateOnly('2023-12-15'), toDateOnly('2023-12-12'))

3(일)을 반환합니다.

dateDiff(toDateTimeOnly('2023-12-15T00:00:00'), toDateTimeOnly('2023-12-12T00:00:00'))

259200000(밀리초, 3일에 해당)를 반환합니다.

dateDiff(now(), toDateTime('2024-12-25T00:00:00Z'))

오늘과 2024년 12월 25일 사이의 밀리초 수를 반환합니다.

dateDiff(#{ExperiencePlatform.ProfileFieldGroup.person.birthDate}, toDateOnly('2023-01-01'))

birthDate이(가) dateOnly(으)로 입력되었다고 가정할 때 프로필의 birthDate 필드와 2023년 1월 1일 사이의 일 수를 반환합니다.

inLastDays inLastDays

지정된 dateTime이 now와 now 사이에 있으면 true를 반환합니다(델타 일).

구문
inLastDays(<dateTime>,<delta>)
매개변수
table 0-row-2 1-row-2 2-row-2
매개 변수 유형
날짜 시간 dateTime
델타 정수
서명 및 반환된 유형

inLastDays(<dateTime>,<integer>)

부울 반환.

예시

inLastDays(toDateTime('2023-12-12T01:11:00Z'), 4)

true를 반환합니다.

inLastHours inLastHours

지정된 날짜 시간이 지금부터 델타 시간 사이인 경우 true를 반환합니다.

구문
inLastHours(<dateTime>,<delta>)
매개변수
table 0-row-2 1-row-2 2-row-2
매개 변수 유형
날짜 시간 dateTime
델타 정수
서명 및 반환된 유형

inLastHours(<dateTime>,<integer>)

부울 반환.

예시

inLastHours(toDateTime('2023-12-12T01:11:00Z'), 4)

true를 반환합니다.

inLastHours(@event{MyEvent.timestamp}, 4)

true를 반환합니다.

inLastMonths inLastMonths

지정된 date 또는 dateTime이 now와 now 사이에 있으면 true를 반환합니다(델타 월).

구문
inLastMonths(<dateTime>,<delta>)
매개변수
table 0-row-2 1-row-2 2-row-2
매개 변수 유형
날짜 시간 dateTime
델타 정수
서명 및 반환된 유형

inLastMonths(<dateTime>,<integer>)

부울 반환.

예시

inLastMonths(toDateTime('2023-12-12T01:11:00Z'), 4)

true를 반환합니다.

inLastYears inLastYears

지정된 date 또는 dateTime이 now와 now 사이에 있으면 true를 반환합니다(델타 연도).

구문
inLastYears(<dateTime>,<delta>)
매개변수
table 0-row-2 1-row-2 2-row-2
매개 변수 유형
날짜 시간 dateTime
델타 정수
서명 및 반환된 유형

inLastYears(<dateTime>,<integer>)

부울 반환.

예시

inLastYears(toDateTime('2023-12-12T01:11:00Z'), 4)

true를 반환합니다.

inNextDays inNextDays

지정된 date 또는 dateTime이 now와 now + delta 일 사이인 경우 true를 반환합니다.

구문
inNextDays(<dateTime>,<delta>)
매개변수
table 0-row-2 1-row-2 2-row-2
매개 변수 유형
날짜 시간 dateTime
델타 정수
서명 및 반환된 유형

inNextDays(<dateTime>,<integer>)

부울 반환.

예시

inNextDays(toDateTime('2023-12-12T01:11:00Z'), 4)

true를 반환합니다.

inNextHours inNextHours

지정된 date 또는 dateTime이 now와 now + delta 시간 사이에 있으면 true를 반환합니다.

구문
inNextHours(<dateTime>,<delta>)
매개변수
table 0-row-2 1-row-2 2-row-2
매개 변수 유형
날짜 시간 dateTime
델타 정수
서명 및 반환된 유형

inNextHours(<dateTime>,<integer>)

부울 반환.

예시

inNextHours(toDateTime('2023-12-12T01:11:00Z'), 4)

true를 반환합니다.

inNextMonths inNextMonths

지정된 date 또는 dateTime이 now와 now + delta 개월 사이에 있으면 true를 반환합니다.

구문
inNextMonths(<dateTime>,<delta>)
매개변수
table 0-row-2 1-row-2 2-row-2
매개 변수 유형
날짜 시간 dateTime
델타 정수
서명 및 반환된 유형

inNextMonths(<dateTime>,<integer>)

부울 반환.

예시

inNextMonths(toDateTime('2023-01-12T01:11:00Z'), 4)

true를 반환합니다.

inNextYears inNextYears

지정된 date 또는 dateTime이 now와 now + delta years 사이에 있으면 true를 반환합니다.

구문
inNextYears(<dateTime>,<delta>)
매개변수
table 0-row-2 1-row-2 2-row-2
매개 변수 유형
날짜 시간 dateTime
델타 정수
서명 및 반환된 유형

inNextYears(<dateTime>,<integer>)

부울 반환.

예시

inNextYears(toDateTime('2021-12-12T01:11:00Z'), 4)

true를 반환합니다.

now now

현재 날짜를 날짜 시간 형식으로 반환합니다. 데이터 형식에 대한 자세한 내용은 이 페이지를 참조하세요.

NOTE
이 함수는 여정 표현식에서만 사용할 수 있습니다. 전자 메일 개인화 및 기타 콘텐츠의 경우 getCurrentZonedDateTime()을(를) 대신 사용하십시오. 자세히 알아보기
구문
now(<parameter>)
매개변수
table 0-row-2 1-row-2
매개변수 설명
문자열 시간대 식별자(선택 사항)
서명 및 반환된 유형

now()

now("<timeZone id>")

dateTime을 반환합니다.

now()

2023-06-03T06:30Z를 반환합니다.

toString(now())

“2023-06-03T06:30Z” 반환

now("Europe/Paris")

2023-06-03T08:30+02:00을 반환합니다.

nowWithDelta nowWithDelta

오프셋을 포함하여 현재 날짜/시간을 반환합니다. 시간대 ID를 지정하면 시간대 오프셋이 적용됩니다. 데이터 형식에 대한 자세한 내용은 이 페이지를 참조하세요.

구문
nowWithDelta(<parameters>)
매개변수
table 0-row-2 1-row-2 2-row-2 3-row-2
매개변수 설명
델타 양의 정수 값 또는 음의 정수 값
날짜 부분 years, months, days, hours, minutes 또는 seconds as a string
시간대 id 시간대 값의 문자열 표현입니다. 자세한 내용은 데이터 형식을 참조하세요. 시간대 ID는 문자열 상수여야 합니다. 필드 참조나 식이 될 수 없습니다.
서명 및 반환된 유형

nowWithDelta(<delta>,<date part>

nowWithDelta(<delta>,<date part>,"<timeZone id>")

dateTime을 반환합니다.

예시

nowWithDelta(-2, "hours")

nowWithDelta(-2, "hours", "Europe/Paris")

정확히 2시간 전의 dateTime을 반환합니다.

nowWithDelta(1, "months", "Asia/Tokyo")

2026-01-31에 대해 평가하면 2026-02-28T…를 반환합니다.; 2026-05-31에 대해 평가하면 2026-06-30T…를 반환합니다.

nowWithDelta()은(는) 달력-월 산술 연산을 사용합니다. 대상 월의 일 수가 현재 월별 날짜보다 적은 경우 결과는 해당 월의 마지막 유효 날짜로 표준화됩니다. 함수가 다음 달로 롤오버되지 않습니다.

setHours setHours

날짜 시간 또는 날짜 시간의 시간만 설정합니다. 예를 들어 내일 특정 시간까지 기다리려면 시간을 강제로 지정할 수 있습니다.

구문
setHours(<parameter>)
매개변수
table 0-row-2 1-row-2 2-row-2 3-row-2
매개 변수 유형
날짜 시간 dateTime
시간대를 고려하지 않은 날짜 시간 dateTimeOnly
시간 정수
서명 및 반환된 유형

setHours(<dateTime>,<hours>)

날짜/시간을 반환합니다.

setHours(<dateTimeOnly>,<hours>)

시간대를 고려하지 않고 날짜/시간을 반환합니다.

예시

setHours(toDateTime('2023-12-12T01:11:00Z'), 4)

2023-12-12T04:11:00Z를 반환합니다.

setHours(nowWithDelta(1, "days"), 20)

내일 오후 8:XY에 반환합니다. XY는 현재 시간 평가 시점의 분입니다. 오전 2시 45분에 평가가 이뤄지면 돌아오는 시간은 오후 8시 45분이다.

setDays setDays

날짜/시간 또는 날짜/시간만 설정합니다. 예를 들어, 특정 날짜까지 기다리려면 날짜를 강제로 지정할 수 있습니다.

구문
setDays(<parameter>)
매개변수
table 0-row-2 1-row-2 2-row-2 3-row-2
매개 변수 유형
날짜 시간 dateTime
시간대를 고려하지 않은 날짜 시간 dateTimeOnly
정수
서명 및 반환된 유형

setDays(<dateTime>,<days>)

날짜/시간을 반환합니다.

setDays(<dateTimeOnly>,<days>)

시간대를 고려하지 않고 날짜/시간을 반환합니다.

예시

setDays(toDateTime('2023-12-12T01:11:00Z'), 25)

2023-12-25T01:11:00Z를 반환합니다.

setDays(toDateTimeOnly(@event{MyEvent.registrationDate}), 1)

updateTimeZone updateTimeZone

같은 순간에 새 시간대와 함께 새 날짜 시간을 반환합니다.

구문
updateTimeZone(<parameters>)
매개변수
  • 시간대 id: 문자열
  • dateTime
서명 및 반환된 유형

updateTimeZone(<dateTime>,<timeZone id>)

날짜/시간을 반환합니다.

updateTimeZone( toDateTime("2023-08-28T08:15:30.123-07:00"), "Europe/Paris"))

2023-08-28T17:15:30.123+02:00을 반환합니다.

updateTimeZone(@event{MyExpEvent.timestamp}, "Australia/Sydney")

타임스탬프 필드의 값이 2021-11-16T16:55:12.939318+01:00이면 함수는 2021-11-17T02:55:12.942115+11:00을(를) 반환합니다.

AI Knowledge Reference

This section contains structured knowledge intended to support interpretation, retrieval, and question answering related to this topic.

For complete understanding, this information should be combined with the documentation on this page. Neither source is intended to stand alone; the page describes the feature, while this section provides additional context that helps disambiguate terminology, intent, applicability, and constraints.

  • TL;DR: This page documents all date and time functions available in AJO journey expressions, covering how to get the current time, check whether a date falls within a relative time window, and modify date/time components.

Intents:

  • Get the current datetime (with optional timezone) using now or nowWithDelta
  • Retrieve the current time as an epoch integer using currentTimeInMillis
  • Calculate the difference between two dates or date-times using dateDiff
  • Check if a datetime falls within the last N days, hours, months, or years using inLastDays, inLastHours, inLastMonths, inLastYears
  • Check if a datetime falls within the next N days, hours, months, or years using inNextDays, inNextHours, inNextMonths, inNextYears
  • Force a specific hour or day of the month on a datetime value using setHours or setDays
  • Convert a datetime to a different timezone while preserving the same instant using updateTimeZone

Glossary:

  • dateOnly: A date value with no time or timezone information (product-specific)
  • dateTime: A date-time value that includes timezone offset information (product-specific)
  • dateTimeOnly: A date-time value with no timezone information (product-specific)
  • epoch milliseconds: An integer representing the number of milliseconds elapsed since 1970-01-01T00:00:00Z
  • delta: An integer offset (positive or negative) used with nowWithDelta to shift the current time by a number of years, months, days, hours, minutes, or seconds

Guardrails:

  • now() is only available in journey expressions; for email personalization use getCurrentZonedDateTime() instead
  • The timezone ID in nowWithDelta must be a string constant — field references and dynamic expressions are not supported
  • The timezone ID in updateTimeZone must be a string constant
  • dateDiff requires both parameters to be the same data type (dateOnly, dateTimeOnly, or dateTime); mixing types is not supported
  • dateDiff returns null if either parameter is null
  • dateDiff returns days for dateOnly parameters, but milliseconds (not days) for dateTimeOnly and dateTime parameters — convert accordingly when comparing results across types

Terminology:

  • Canonical name: Date functions — Acronym: none — variants: date-time functions, temporal functions
  • Synonyms: “now()” = “current datetime”; “currentTimeInMillis()” = “current epoch milliseconds”
  • Do not confuse: “inLastDays” (looks back in time) ≠ “inNextDays” (looks forward in time)
  • Do not confuse: “setHours” (replaces the hour component) ≠ “nowWithDelta” (offsets the current time)
  • Do not confuse: “updateTimeZone” (same instant, different timezone representation) ≠ “setHours” (changes the time value itself)
  • Do not confuse: the journey expression editor’s dateDiff (accepts dateOnly, dateTimeOnly, or dateTime; returns days or milliseconds depending on type) ≠ the personalization editor’s dateDiff (accepts only dateTime; always returns days)

FAQ:

  • Q: Can I use now() in email personalization content? — No, now() is only available in journey expressions. Use getCurrentZonedDateTime() for email personalization.
  • Q: How do I check if an event happened in the last 24 hours? — Use inLastHours(@event{MyEvent.timestamp}, 24).
  • Q: How do I get the current time offset by 2 hours in the past? — Use nowWithDelta(-2, "hours").
  • Q: What does updateTimeZone do differently from setHours?updateTimeZone keeps the same instant in time but expresses it in a different timezone, while setHours actually changes the hour component of the datetime value.
  • Q: Can the timezone parameter in nowWithDelta be a profile field? — No, the timezone ID must be a string constant; field references are not supported.
  • Q: What happens when nowWithDelta() is used with months and the current date is a month-end date? — The function uses calendar-month arithmetic and normalizes the result to the last valid day of the target month. For example, adding 1 month to January 31 returns February 28 (not March 3).
recommendation-more-help
journey-optimizer-help