Date Time Format

I am saving the openfire log in a database, but the format of the date is it 1188813724606 , it isnt POSIX, is it ? How do I convert it to a normal date (10-01-2001)

thanks.

It’s time in millisec since January 1, 1970, 00:00:00 GMT, which is long datatype in Java, but stored as string in the table using Long.toString(long, 15) so that it is portably stored in all kinds of databases.

I’m assuming you’re using Java… To convert it back to Date, you just call Date(Long.parseLong(“theTimeString”)). You may then use java.text.SimpleDateFormat class, or Openfire’s own API in org.jivesoftware.util.FastDateFormat to format the date for display.

I am using php

Sorry, I’m not sure how you do it in php. However, if all you need is a POSIX compliant time to start with, I’m sure you can get the conversion function in php if you google around

I am using php

No problem, PHP works with seconds since January 1, 1970, 00:00:00 GMT. So just divide the value through 1000, respectively multiply by 1000.

Coolcat

Message was edited by: Coolcat