How can I get UTC time in a bash script variable?
Hi I have a script that needs utc time and I am using
eDateTime=`date +"%Y%m%d_%H%M%S"`
It isnt returning UTC time from what I can see.
Any tips?
Many thanks
Hi I have a script that needs utc time and I am using
eDateTime=`date +"%Y%m%d_%H%M%S"`
It isnt returning UTC time from what I can see.
Any tips?
Many thanks
eDateTime=$(date -u +"%Y%m%d_%T")
20220706_14:13:53
The -u switch returns UTC time, and in the preceding case, this was done at 10:13 EDT today. The back ticks (`) are antiquated shell semantics and have been superceded with the $() expression.
eDateTime=$(date -u +"%Y%m%d_%T")
20220706_14:13:53
The -u switch returns UTC time, and in the preceding case, this was done at 10:13 EDT today. The back ticks (`) are antiquated shell semantics and have been superceded with the $() expression.
TZ=UTC date +"%Y%m%d_%H%M%S"
@VikingOSX Thanks so much for that.... A few hours of tweaking saved!
You are welcome.
How can I get UTC time in a bash script variable?