Portable general timestamp format, not 2038-limited

Roedy Green see_website at mindprod.com.invalid
Sun Jun 24 11:13:02 CEST 2007

On Fri, 22 Jun 2007 13:33:04 -0700, James Harris
<james.harris.1 at googlemail.com> wrote, quoted or indirectly quoted
someone who said :

>1) subsecond resolution - milliseconds or, preferably, more detailed
>2) not bounded by Unix timestamp 2038 limit
>3) readable in Java
>4) writable portably in Perl which seems to mean that 64-bit values
>are out
>5) readable and writable in Python
>6) storable in a free database - Postgresql/MySQL

Unix gets in trouble in 2038 only with 32-bit timestamps. Java's
64-bit longs are fine.

If you need code to create timestamps, you can modify parts of BigDate
to run in Perl or Python. 
see http://mindprod.com/products1.html#BIGDATE

To get more detailed, just use a unix long timestamp multiplied by
1000 to track in microseconds.

You can use MS nanosecond timestamps. see

just store them as longs in the database.  The only catch is ad-hoc
queries won't work with them. 

JDBC out the box should be fine.  
one of :
DATE	java.sql.Date
TIME	java.sql.Time
TIMESTAMP	java.sql.Timestamp
will be what you need.

Roedy Green Canadian Mind Products
The Java Glossary

More information about the Python-list mailing list