Just tested this code on both my Windows (8) workstation and an AIX:
public static void main(String[] args) {
System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSS").format(new Date()));
System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSSSS").format(new Date()));
}
and got something similar to this as a result:
2013-10-07 12:53:26.000905
2013-10-07 12:53:26.000906
Can someone please explain me what are the last digits, if not microseconds?
Note: I interact with a DB2 database in which chronological data is stored using timed columns as TIMESTAMP with 6 digits AFTER the seconds i.e. microseconds (IMO).
But all those "timestamps" are created by requesting the following query:
SELECT current timestamp as currenttimestamp FROM Table ( values (1)) temp
I wonder if, given the above results, I couldn't just use in my code new Date()
instead of selecting the current timestamp
from the database.
Thanks.
PS: I searched but found no relevant (answered) questions, like:
Current time in microseconds in java
or
Get time with hour, minute, second, millisecond, microsecond
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…