mirror of
https://github.com/natelandau/shell-scripting-templates.git
synced 2025-11-09 21:53:47 -05:00
Now has and set LC_ALL=C to all dates
This commit is contained in:
@@ -3,12 +3,13 @@
|
|||||||
# ##################################################
|
# ##################################################
|
||||||
# Shared bash functions used by my bash scripts.
|
# Shared bash functions used by my bash scripts.
|
||||||
#
|
#
|
||||||
# VERSION 1.0.0
|
# VERSION 1.0.2
|
||||||
#
|
#
|
||||||
# HISTORY
|
# HISTORY
|
||||||
#
|
#
|
||||||
# * 2015-01-02 - v1.0.0 - First Creation
|
# * 2015-01-02 - v1.0.0 - First Creation
|
||||||
# * 2015-08-05 - v1.0.1 - Now has $hourstamp (10:34:40 PM)
|
# * 2015-08-05 - v1.0.1 - Now has $hourstamp (10:34:40 PM)
|
||||||
|
# * 2016-01-10 - v1.0.2 - Now has $longdate and set LC_ALL=C to all dates
|
||||||
#
|
#
|
||||||
# ##################################################
|
# ##################################################
|
||||||
|
|
||||||
@@ -24,11 +25,12 @@ scriptBasename="$(basename ${scriptName} .sh)" # Strips '.sh' from scriptName
|
|||||||
# Prints the current date and time in a variety of formats:
|
# Prints the current date and time in a variety of formats:
|
||||||
#
|
#
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
now=$(date +"%m-%d-%Y %r") # Returns: 06-14-2015 10:34:40 PM
|
now=$(LC_ALL=C date +"%m-%d-%Y %r") # Returns: 06-14-2015 10:34:40 PM
|
||||||
datestamp=$(date +%Y-%m-%d) # Returns: 2015-06-14
|
datestamp=$(LC_ALL=C date +%Y-%m-%d) # Returns: 2015-06-14
|
||||||
hourstamp=$(date +%r) # Returns: 10:34:40 PM
|
hourstamp=$(LC_ALL=C date +%r) # Returns: 10:34:40 PM
|
||||||
timestamp=$(date +%Y%m%d_%H%M%S) # Returns: 20150614_223440
|
timestamp=$(LC_ALL=C date +%Y%m%d_%H%M%S) # Returns: 20150614_223440
|
||||||
today=$(date +"%m-%d-%Y") # Returns: 06-14-2015
|
today=$(LC_ALL=C date +"%m-%d-%Y") # Returns: 06-14-2015
|
||||||
|
longdate=$(LC_ALL=C date +"%a, %d %b %Y %H:%M:%S %z") # Returns: Sun, 10 Jan 2016 20:47:53 -0500
|
||||||
|
|
||||||
# THISHOST
|
# THISHOST
|
||||||
# ------------------------------------------------------
|
# ------------------------------------------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user