bash - Format date in AWS's style -


i'm looking compare dates of aws resources in external script need match aws's date/time format.

aws' own documentation states date must the complete date plus hours, minutes, , seconds, date formats end looking 2017-07-27t15:47:59.373z, hardcoding of %y-%m-%dt%h:%m.%sz gets me 2017-07-15t11:39.29z.

side side, that's:

aws: ???                - 2017-07-27t15:47:59.373z me:  %y-%m-%dt%h:%m.%sz - 2017-07-15t11:39.29z 

there's on end that's adding few digits. missing formatting identical?

the "extra digits" milliseconds.

i'm assuming you're using bash's date command. if that's case, try with:

date -u +"%y-%m-%dt%h:%m:%s.%3nz" 

the -u option gets date in utc (so it's compliant z, utc designator).

if don't use -u, it'll print date , time in system's timezone (which can't utc).


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -