1. Shell script as follows
current=`date "+%Y-%m-%d %H:%M:%S"`
timeStamp=`date -d "$current" +%s`
#将current转换为时间戳,精确到毫秒
currentTimeStamp=$((timeStamp*1000+`date "+%N"`/1000000))
echo $currentTimeStamp
2. Operation effect
3. Note h2>
this in timestamp way has a small error, the need to obtain precise timestamp refer to: https://blog.csdn.net/AQ931752921/article/details/85071221 p>
Read More:
- Shell gets the current time of the system and formats it
- The shell gets the current time of the system and formats it
- An undetermined call to function ‘shell’: missing ‘. Stop. Problem encountered when using shell command in makefile
- How to get the current time in java time string
- Linux shell gets the file name under the folder
- Exponentiation in shell
- Centos8 solves SSH secure shell error algorithmic negotiation failures
- Linux shell RM deletes all. O suffix files in the subdirectory
- Solve the problem of shell script “syntax error near unexpected token `fi’”.
- Set the default time to the current value in MySQL
- Linux view current date and time
- If elif writing method of shell script
- Shell script syntax error near unexpected token ‘$’Do
- Shell removes double quotes from strings
- The shell script exits after an error is reported
- Shell script running error bash: JPS: command not found
- Shell script – EQ – Ne – GT – LT – ge – le
- Error BC: command not found when git bash runs shell script
- Solution to shell script invocation error during Xcode real machine test
- The method of getting shell command output in Python