UltipaDocs
Try Playground
  • Introduction
  • Terminologies
    • Reserved Words
    • Data Types
    • Alias
    • Operators
    • Expression
    • Filter
    • Prefix
    • Node and Edge Templates
    • Homologous and Heterologous Data
    • Clause Execution Times
    • Graphset
    • Schema
    • Property
    • Insert
    • Overwrite
    • Upsert
    • Update
    • Delete
    • Find Nodes
    • Find Edges
      • AB
      • Autonet
      • Spread
      • Path Template
      • K-Hop
      • K-Hop Template
    • Find Subgraphs
    • GROUP BY
    • ORDER BY
    • SKIP
    • LIMIT
    • WHERE
    • RETURN
    • WITH
    • UNCOLLECT
    • UNION
    • UNION ALL
    • CALL
    • BATCH
      • Schema Checker
      • Equal
      • Not Equal
      • Less Than
      • Greater Than
      • Less Than or Equal
      • Greater Than or Equal
      • Between
      • Between or Equal
      • Beong to
      • Not Belong To
      • CONTAINS | String
      • CONTAINS | Full-Text
      • Regular Match
      • IS NULL
      • IS NOT NULL
      • And
      • Or
      • Not
      • Exclusive OR
      • DISTINCT
      • toString()
      • toInteger()
      • toFloat()
      • toDouble()
      • toDecimal()
      • toSet()
      • castToRaw()
      • now()
      • dateAdd()
      • dateDiff()
      • year()
      • month()
      • day()
      • dayOfWeek()
      • dateFormat()
      • point()
      • distance()
      • pointInPolygon()
      • lower()
      • upper()
      • reverse()
      • startsWith()
      • endsWith()
      • JSON_decode()
      • JSON_merge()
      • trim()
      • ltrim()
      • rtrim()
      • left()
      • right()
      • substring()
      • replace()
      • split()
      • intersection()
      • difference()
      • listUnion()
      • size()
      • head()
      • reduce()
      • listContains()
      • append()
      • pi()
      • pow()
      • sqrt()
      • abs()
      • floor()
      • ceil()
      • round()
      • sin()
      • cos()
      • tan()
      • cot()
      • asin()
      • acos()
      • atan()
      • length()
      • pnodes()
      • pedges()
      • count()
      • sum()
      • max()
      • min()
      • avg()
      • stddev()
      • collect()
      • dedup()
      • CASE
      • table()
      • coalesce()
      • ifnull()
    • Acceleration
    • Index
    • Full-text
    • LTE
    • Real-time Process
    • Backend Task
    • Analytics Node
    • Server Statistics
    • Server Backup
    • Privilege
    • Policy
    • User
  • Trigger
  1. Docs
  2. /
  3. UQL
  4. /
  5. Temporal Functions

dateFormat()

Overview

The dateFormat() function prints a specific format for a given time value.

Syntax

dateFormat(time, format)

Augment
Type
Description
timeDatetime, timestamp, stringThe time value
formatStringThe format to print the time

Date/Time format codes:

Code
Description
Examples / Range
%aAbbreviated weekday name in the system language(en_US) Sun, Mon
%AFull weekday name in the system language(en_US) Sunday, Monday
%bAbbreviated month name in the system language(en_US) Jan, Feb
%BFull month name in the system language(en_US) January, February
%cDefault date and time format in the system settingsWed Jan 11 10:59:28 2023
%CCentury number (year/100) in 2 digits00, 01, ..., 99
%dDay of the month (zero-padded)01, 02, ..., 31
%DEquivalent to %m/%d/%y01/11/23
%eDay of the month1, 2, ..., 31
%EzTime zone+08:00
%gYear without the century00, 01, ..., 99
%GYear in 4 digits0000, 0001, ..., 9999
%hEquivalent to %bSee %b
%HHour using a 24-hour clock (zero-padded)00, 01, ..., 23
%IHour using a 12-hour clock (zero-padded)01, 02, ..., 12
%jDay of the year (zero-padded)001, 002, ..., 366
%mMonth of the year (zero-padded)01, 02, ..., 12
%MMinute (zero-padded)00, 01, ..., 59
%nLine break
%pEither 'AM' or 'PM' according to the given time value(en_US) AM, PM
%PEither 'am' or 'pm' according to the given time value(en_US) am, pm
%rEquivalent to %I/%M/%S %p01:49:23 AM
%REquivalent to %H:%M13:49
%SSecond (zero-padded)00, 01, ..., 59
%tTab
%TEquivalent to %H:%M:%S23:02:05
%uDay number of the week, Monday being 1 (Sunday being 1 in a Sun Solaris system)1, 2, ..., 7
%UWeek number of the year (zero-padded), starting with the first Sunday as the first day of week 0100, 01, ..., 53
%VWeek number of year (zero-padded), with Monday as the first day of the week, week 01 is the first week that has at least 4 days in the current year01, 02, ..., 53
%WWeek number of the year (zero-padded), starting with the first Monday as the first day of week 0100, 01, ..., 53
%wDay number of the week, Sunday being 00, 1, ..., 6
%xDefault date format in the system settings01/11/23
%XDefault time format in the system settings06:38:45
%yEquivalent to %gSee %g
%YEquivalent to %GSee %G
%zOffset from UTC in the format of ±HHMM[SS]+0000, -0400, +1030, ...
%ZName of the time zoneGMT, UTC, IST, CST, ...
%%Character %%

Return type: String

Example of Result

UQL
return dateFormat("2010/9/25 6:12:30","%A %e %B, %G")

Result: Saturday 25 September, 2010

Example of Use

Display the times of reviews in a desired format.

UQL
find().nodes({@review}) as n
return dateFormat(n.time,"%e %b, %G")