Redivis Documentation
API DocumentationRedivis Home
  • Introduction
  • Redivis for open science
    • FAIR data practices
    • Open access
    • Data repository characteristics
    • Data retention policy
    • Citations
  • Guides
    • Getting started
    • Discover & access data
      • Discover datasets
      • Apply to access restricted data
      • Create a study
    • Analyze data in a workflow
      • Reshape data in transforms
      • Work with data in notebooks
      • Running ML workloads
      • Example workflows
        • Analyzing large tabular data
        • Create an image classification model
        • Fine tuning a Large Language Model (LLM)
        • No-code visualization
        • Continuous enrollment
        • Select first/last encounter
    • Export & publish your work
      • Export to other environments
      • Build your own site with Observable
    • Create & manage datasets
      • Create and populate a dataset
      • Upload tabular data as tables
      • Upload unstructured data as files
      • Cleaning tabular data
    • Administer an organization
      • Configure access systems
      • Grant access to data
      • Generate a report
      • Example tasks
        • Emailing subsets of members
    • Video guides
  • Reference
    • Your account
      • Creating an account
      • Managing logins
      • Single Sign-On (SSO)
      • Workspace
      • Studies
      • Compute credits and billing
    • Datasets
      • Documentation
      • Tables
      • Variables
      • Files
      • Creating & editing datasets
      • Uploading data
        • Tabular data
        • Geospatial data
        • Unstructured data
        • Metadata
        • Data sources
        • Programmatic uploads
      • Version control
      • Sampling
      • Exporting data
        • Download
        • Programmatic
        • Google Data Studio
        • Google Cloud Storage
        • Google BigQuery
        • Embedding tables
    • Workflows
      • Workflow concepts
      • Documentation
      • Data sources
      • Tables
      • Transforms
        • Transform concepts
        • Step: Aggregate
        • Step: Create variables
        • Step: Filter
        • Step: Join
        • Step: Limit
        • Step: Stack
        • Step: Order
        • Step: Pivot
        • Step: Rename
        • Step: Retype
        • Step: SQL query
        • Variable selection
        • Value lists
        • Optimization and errors
        • Variable creation methods
          • Common elements
          • Aggregate
          • Case (if/else)
          • Date
          • DateTime
          • Geography
          • JSON
          • Math
          • Navigation
          • Numbering
          • Other
          • Statistical
          • String
          • Time
      • Notebooks
        • Notebook concepts
        • Compute resources
        • Python notebooks
        • R notebooks
        • Stata notebooks
        • SAS notebooks
        • Using the Jupyter interface
      • Access and privacy
    • Data access
      • Access levels
      • Configuring access
      • Requesting access
      • Approving access
      • Usage rules
      • Data access in workflows
    • Organizations
      • Administrator panel
      • Members
      • Studies
      • Workflows
      • Datasets
      • Permission groups
      • Requirements
      • Reports
      • Logs
      • Billing
      • Settings and branding
        • Account
        • Public profile
        • Membership
        • Export environments
        • Advanced: DOI configuration
        • Advanced: Stata & SAS setup
        • Advanced: Data storage locations
        • Advanced: Data egress configuration
    • Institutions
      • Administrator panel
      • Organizations
      • Members
      • Datasets
      • Reports
      • Settings and branding
    • Quotas and limits
    • Glossary
  • Additional Resources
    • Events and press
    • API documentation
    • Redivis Labs
    • Office hours
    • Contact us
    • More information
      • Product updates
      • Roadmap
      • System status
      • Security
      • Feature requests
      • Report a bug
Powered by GitBook
On this page
  • Current DateTime
  • New DateTime
  • DateTime add
  • DateTime diff
  • DateTime subtract
  • DateTime truncate
  • DateTime extract
  • Format dateTime
  • Parse dateTime

Was this helpful?

Export as PDF
  1. Reference
  2. Workflows
  3. Transforms
  4. Variable creation methods

DateTime

Last updated 1 year ago

Was this helpful?

Current DateTime

Returns the current dateTime –>

CURRENT_DATETIME([@time_zone])

Return type

dateTime

Parameters

Name
Type
Allowed values
Required
Placeholder (in UI)

@time_zone

any of: ACDT, ACST, ACT, ACT, ACWST, ADT, AEDT, AEST, AFT, AKDT, AKST, AMST, AMT, AMT, ART, AST, AST, AWST, AZOST, AZOT, AZT, BDT, BIOT, BIT, BOT, BRST, BRT, BST, BST, BST, BTT, CAT, CCT, CDT, CDT, CEST, CET, CHADT, CHAST, CHOT, CHOST, CHST, CHUT, CIST, CIT, CKT, CLST, CLT, COST, COT, CST, CST, CST, CT, CVT, CWST, CXT, DAVT, DDUT, DFT, EASST, EAST, EAT, ECT, ECT, EDT, EEST, EET, EGST, EGT, EIT, EST, FET, FJT, FKST, FKT, FNT, GALT, GAMT, GET, GFT, GILT, GIT, GMT, GST, GST, GYT, HDT, HAEC, HST, HKT, HMT, HOVST, HOVT, ICT, IDLW, IDT, IOT, IRDT, IRKT, IRST, IST, IST, IST, JST, KALT, KGT, KOST, KRAT, KST, LHST, LHST, LINT, MAGT, MART, MAWT, MDT, MET, MEST, MHT, MIST, MIT, MMT, MSK, MST, MST, MUT, MVT, MYT, NCT, NDT, NFT, NPT, NST, NT, NUT, NZDT, NZST, OMST, ORAT, PDT, PET, PETT, PGT, PHOT, PHT, PKT, PMDT, PMST, PONT, PST, PST, PYST, PYT, RET, ROTT, SAKT, SAMT, SAST, SBT, SCT, SDT, SGT, SLST, SRET, SRT, SST, SST, SYOT, TAHT, THA, TFT, TJT, TKT, TLT, TMT, TRT, TOT, TVT, ULAST, ULAT, UTC, UYST, UYT, UZT, VET, VLAT, VOLT, VOST, VUT, WAKT, WAST, WAT, WEST, WET, WIT, WST, YAKT, YEKT

false

(UTC (default))

New DateTime

Constructs a dateTime from a year, month, day, hour, minute, and second –>

DATETIME(@year, @month, @day, @hour, @minute, @second)

Return type

dateTime

Parameters

Name
Type
Allowed values
Required
Placeholder (in UI)

@year

true

-

@month

true

-

@day

true

-

@hour

true

-

@minute

true

-

@second

true

-

DateTime add

DATETIME_ADD(@dateTime_expression, INTERVAL @integer_expression @dateTime_part)

Return type

dateTime

Parameters

Name
Type
Allowed values
Required
Placeholder (in UI)

@integer_expression

true

-

@dateTime_part

any of: year, quarter, month, week, day, hour, minute, second, millisecond, microsecond

true

((e.g., days))

@dateTime_expression

true

-

DateTime diff

DATETIME_DIFF(@dateTime_expression, @dateTime_expression_2, @dateTime_part)

Return type

integer

Parameters

Name
Type
Allowed values
Required
Placeholder (in UI)

@dateTime_expression_2

true

-

@dateTime_expression

true

-

@dateTime_part

any of: year, quarter, month, week, day, hour, minute, second, millisecond, microsecond

true

((e.g., days))

DateTime subtract

DATETIME_SUB(@dateTime_expression, INTERVAL @integer_expression @dateTime_part)

Return type

dateTime

Parameters

Name
Type
Allowed values
Required
Placeholder (in UI)

@integer_expression

true

-

@dateTime_part

any of: year, quarter, month, week, day, hour, minute, second, millisecond, microsecond

true

((e.g., days))

@dateTime_expression

true

-

DateTime truncate

DATETIME_TRUNC(@dateTime_expression, @dateTime_truncate_part)

Return type

dateTime

Parameters

Name
Type
Allowed values
Required
Placeholder (in UI)

@dateTime_expression

true

-

@dateTime_truncate_part

any of: hour, minute, second, millisecond, microsecond, day, month, quarter, year, week(sunday), week(monday), week(tuesday), week(wednesday), week(thursday), week(friday), week(saturday), ISOquarter, ISOyear

true

((e.g., minutes))

DateTime extract

EXTRACT(@dateTime_part FROM @date_expression)

Return type

integer

Parameters

Name
Type
Allowed values
Required
Placeholder (in UI)

@dateTime_part

any of: YEAR, QUARTER, MONTH, WEEK, DAY, HOUR, MINUTE, SECOND, MILLISECOND, MICROSECOND, DAYOFYEAR, DAYOFWEEK, ISOYEAR, ISOWEEK

true

((e.g., hour))

@date_expression

true

-

Format dateTime

FORMAT_DATETIME(@format_string, @dateTime_expression)

Return type

string

Parameters

Name
Type
Allowed values
Required
Placeholder (in UI)

@dateTime_expression

true

-

@format_string

true

(e.g., %Y-%m-%d %H:%M:%S)

Parse dateTime

[@safe]PARSE_DATETIME(@format_string, @dateTime_string)

Return type

dateTime

Parameters

Name
Type
Allowed values
Required
Placeholder (in UI)

@dateTime_string

true

-

@format_string

true

(e.g., %Y-%m-%d %H:%M:%S)

@safe

true

-

or

any

or

any

or

any

or

any

or

any

or

any

Add a period of time to a dateTime –>

or

any

or

any

Calculate distance between two dateTimes –>

or

any

or

any

Subtract a period of time from a dateTime –>

or

any

or

any

Truncates a DateTime to the nearest boundary –>

or

any

Extracts the date or time part (e.g, hour) from a DateTime –>

or

any

Returns a formatted string from a dateTime –>

or

any

any

More details about format strings

Parses a dateTime from a string –>

or

any

any

any

More details about format strings

learn more
learn more
learn more
learn more
learn more
learn more
learn more
learn more
here
learn more
here
enum
variable
literal
integer
variable
literal
integer
variable
literal
integer
variable
literal
integer
variable
literal
integer
variable
literal
integer
variable
literal
integer
enum
variable
literal
dateTime
variable
literal
dateTime
variable
literal
dateTime
enum
variable
literal
integer
enum
variable
literal
dateTime
variable
literal
dateTime
enum
enum
variable
literal
dateTime
variable
literal
dateTime
literal
string
variable
literal
string
literal
string
boolean
boolean