The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 12-06-2005
vino's Avatar
vino vino is offline
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,643
Quote:
Originally Posted by Bhups
need to get timestamp with millisecond in UNIX. Date command gives Year,month day, hour,minute and second but it does not give millisecond.
As I understand, you need a timestamp with millisecond precision.

Works with GNU date.

Code:
sh-2.05b$ cat bhups.ksh
#! /bin/ksh
epoch=$(date +%F-%l-%M-%S-)$(( $(date +%N) / 1000000 ))
echo $epoch
sh-2.05b$ ./bhups.ksh 
2005-12-06- 4-22-35-195
vino

Last edited by vino; 12-06-2005 at 04:28 AM.
Reply With Quote