#] #] ********************* #] "$d_SysMaint"'date notes.txt' www.BillHowell.ca ?date initial? #] see "$d_SysMaint""date set.sh" #] sudo date +%Y%m%d --set="20171102" #] sudo date +%T --set="21:07:50" #] #] $ bash "$d_bin""standard header.sh" - #] date - functions return string [date_ymd, date_ddmmmyyyy, date_ymdhm] #] date_ymd=$(date +%y%m%d) #] date_ymdhm=$(date +"%y%m%d %kh%Mm") #] date_ymdhms=$(date +"%y%m%d %kh%Mm%Ss") #] #] date_ddmmmyyyy=$(date +%e%B%Y) #] date_ddmmmyyyy_hm=$(date +"%e%B%Y %kh%Mm") #] #] 0 date option (pad with zeros) doesn't work? #] eg date_ymdhms=$(date +"%0y%0m%0d %0kh%0Mm%0Ss") #08********08 #] ??Sep2023 #08********08 #] ??Sep2023 #08********08 #] ??Sep2023 #08********08 #] ??Sep2023 #08********08 #] 06Sep2023 0 padding of date 13Sep2023 - not working, padding is default anyways (but doesn't always work?) +-----+ https://stackoverflow.com/questions/54066437/date-month-in-bash-without-leading-0-or-space Date - Month in bash without leading 0 or space? Asked 4 years, 8 months ago Modified 1 year, 11 months ago Viewed 15k times You have already removed the padding for the day, why not do the same for the month? $ date +'%-d-%-m-%Y' 7-1-2019 Here's a list of all padding modifiers from man date: By default, date pads numeric fields with zeroes. The following optional flags may follow '%': - (hyphen) do not pad the field _ (underscore) pad with spaces 0 (zero) pad with zeros ^ use upper case if possible # use opposite case if possible After any flags comes an optional field width, as a decimal number; then an optional modifier, which is either E to use the locale's alternate representations if available, or O to use the locale's alternate numeric symbols if available. answered Jan 6, 2019 at 22:21 Lev Levitsky 08********08 13Jul2021 system date code #] +-----+ https://www.cyberciti.biz/faq/unix-date-command-howto-see-set-date-time/ UNIX Date Command Examples and Syntax #] The syntax is: #] date #] date "+format" +-----+ man date NAME date - print or set the system date and time SYNOPSIS date [OPTION]... [+FORMAT] date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] DESCRIPTION Display the current time in the given FORMAT, or set the system date. Mandatory arguments to long options are mandatory for short options too. -d, --date=STRING display time described by STRING, not 'now' -I[FMT], --iso-8601[=FMT] output date/time in ISO 8601 format. FMT='date' for date only (the default), 'hours', 'minutes', 'seconds', or 'ns' for date and time to the indicated precision. Example: 2006-08-14T02:34:56-06:00 -R, --rfc-2822 output date and time in RFC 2822 format. Example: Mon, 14 Aug 2006 02:34:56 -0600 --rfc-3339=FMT output date/time in RFC 3339 format. FMT='date', 'seconds', or 'ns' for date and time to the indi‐ cated precision. Example: 2006-08-14 02:34:56-06:00 %s seconds since 1970-01-01 00:00:00 UTC -u, --utc, --universal print or set Coordinated Universal Time (UTC) >> Try : $ date -u %s date: invalid date ‘%s’ #] $ date --utc +%s #] 1626191582 #] >> OK!!! #] #] $ date --date="Tue, 6 Jul 2021 10:40:06 +0000" --utc +%s #] 1625568006 +-----+ https://en.wikipedia.org/wiki/Unix_time +-----+ https://www.unixtimestamp.com/ The Current Epoch Unix Timestamp >> does conversions but doesn't provide formula # enddoc