Skip to content

SixArm/now

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

now: print the datetime with UTC ISO RFC

Simple programs to print the datetime with UTC ISO RFC formatting as "yyyy-mm-ddThh:mm:ssZ"

  • Date in year with four digits, month zero padded, day zero padded
  • Time in 24-hours zero padded, minutes zero padded, seconds zero padded
  • Coordinated Universal Time (UTC) with the time zone code "Z".
  • Compatible with standards such as ISO 8601 and RFC 9557.

now.sh shell script for Unix, POSIX, sh, bash, zsh:

date -u "+%Y-%m-%dT%H:%M:%SZ"

now.js using JavaScript:

const date = new Date();
console.log(date.toISOString().slice(0, 19) + "Z");

now.pl using Perl:

use POSIX qw(strftime);
print strftime("%Y-%m-%dT%H:%M:%SZ", gmtime);

now.ps using PowerShell:

@powershell -NoProfile -Command "Get-Date ([datetime]::UtcNow) -Format 'yyyy-MM-ddTHH:mm:ssZ'"

now.py using Python:

from datetime import datetime, timezone
ts = datetime.now(timezone.utc).strftime("%Y-%m-%dT%H:%M:%SZ")

now.rs using Rust:

use chrono::Utc;
let now = Utc::now().format("%Y-%m-%dT%H:%M:%SZ").to_string();

now.cmd using command for Windows:

@powershell -NoProfile -Command "Get-Date ([datetime]::UtcNow) -Format 'yyyy-MM-ddTHH:mm:ssZ'"

About

now.ps1 is a PowerShell one-liner to print the datetime now with UTC and format yyyy-MM-ddTHH:mm:ssZ

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors