Nushell
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
Get Nu!
Getting Started
  • The Nushell Book
  • Command Reference
  • Cookbook
  • Language Reference Guide
  • Contributing Guide
Blog
  • English
  • 中文
  • Deutsch
  • Français
  • Español
  • 日本語
  • Português do Brasil
  • Русский язык
  • 한국어
GitHub
  • Language Reference Guide
    • Readme
    • Types in the Nu Language
      • Basic Types
        • Any
        • Boolean
        • Integer
        • Float
        • Filesize
        • Duration
        • Datetime
        • Range
        • String
        • Record
        • List
        • Table
        • Closure
        • Nothing
        • Binary
        • Glob
        • Cell-Path
      • Other Data Types

        • Types used only in command signatures
          • Path
        • Types which are not declarable
          • Error
          • CustomValue
          • Block
      • Type signatures
      • Commands that interact with types
    • Operators
    • Flow control
      • if/else
      • loop
      • while
      • match
      • try/catch
      • break
      • return
      • continue
    • Filters
      • each and par-each
      • Filters to select subsets of data
      • where and filter
      • Understanding the difference between get and select
    • Custom Commands
    • Declarations
    • Variable Scope
    • Strings and Text Formatting
    • Helpers and debugging commands
    • Pipelines
    • MIME Types for Nushell

Datetime

Description:Represents a specific point in time using international standard date time descriptors
Annotation:datetime
Literal syntax:RFC 3339
Date-only: 2022-02-02
Date and time (GMT): 2022-02-02T14:30:00
Date and time including timezone offset: 2022-02-02T14:30:00+05:00
Casts:into datetime
See also:Types of Data - Dates

Additional language notes

  • Dates and times are held together in the datetime type. Date values used by the system are timezone-aware. A datetime literal without a timezone offset uses UTC, while date now returns the current time in the local timezone.

    2022-02-02T14:30:00 | format date "%+"
    # => 2022-02-02T14:30:00+00:00
    2022-02-02T14:30:00+05:00 | format date "%+"
    # => 2022-02-02T14:30:00+05:00

Common commands that can be used with datetime

Many of Nushell's builtin commands are datetime aware and output or use datetime values for fields and expressions. For example:

  • date and its subcommands
  • format date
  • into datetime
  • ls (the modified column)
  • ps --long (the start_time column)
  • sys host (the boot_time column)
Edit this page on GitHub
Contributors: NotTheDr01ds, fdncred
Prev
Duration
Next
Range