linux date得到当前时间的毫秒

sunln00 2012-12-05

echo `expr \`date +%s%N\` / 1000000`

-----------------------------------------------------

#/bin/bash

declarestartTime=`date+%s%N`;

echo `expr $startTime / 1000000`

-----------------------------

#/bin/bash

#test.sh

declaretime_now=`expr\`date+%s%N\`/1000000`;

echo 当前时间毫秒:$time_now;

declare time000n=`date -d \`date +%Y%m%d\` +%s%N`;

declare time_0=`expr $time000n / 1000000`;echo 当前时间取0时0分0秒的毫秒数:$time_0

相关推荐