0

I would like to use date in the following format: yyyyMM.dd.HHmm. i.e. 202008.15.1742

This is the Bash file:

#!/usr/bin/env bash VERSION_CODE=$((($(date +%s%N)/1000000)) plutil -replace CFBundleVersion -string "$VERSION_CODE" 

How do I set VERSION_CODE such that the current time appears in this format: yyyyMM.dd.HHmm?

1
  • 2
    #VERSION_CODE=$(date +%Y%m.%d.%H%M) #echo $VERSION_CODE 202008.13.2155 Commented Aug 14, 2020 at 0:55

2 Answers 2

5

A pure Bash solution without spawning a sub-process:

printf -v VERSION_CODE '%(%Y%m.%d.%H%M)T' 
Sign up to request clarification or add additional context in comments.

Comments

2

You can do it like this:

VERSION_CODE=$(date +"%Y%m.%d.%H%M") 

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.