Skip to content

Instantly share code, notes, and snippets.

@YakDriver
Last active March 1, 2018 14:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save YakDriver/e80970fb46bc861fa34fa1f6319e93fc to your computer and use it in GitHub Desktop.
Save YakDriver/e80970fb46bc861fa34fa1f6319e93fc to your computer and use it in GitHub Desktop.
Linux/bash to display date in UTC format
#!/bin/bash
# Many things want UTC time as input, so here it is. As 14 days ago. Like for a query to AWS spot instance history:
# aws ec2 describe-spot-price-history --instance-types t2.micro --start-time $(date -v-14d -u '+%FT%TZ') --product-description "Linux/UNIX"
#
# Output (of command below, not the aws cli command):
# 2018-02-13T15:24:46Z
#
date -v-14d -u '+%FT%TZ'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment