We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › can anyone make sense from this, timestamp date
Page Index Toggle Pages: 1
can anyone make sense from this, timestamp? date? (Read 806 times)
can anyone make sense from this, timestamp? date?
Jan 20th, 2007, 7:38pm
 
i'm facing a little problem here:

i have an int that looks like:
1144340899

and it should mean:
Thu, 6 Apr 2006 18:28:19 +0200

any ideas how to get the later from the first?

thanks,
F
Re: can anyone make sense from this, timestamp? da
Reply #1 - Jan 20th, 2007, 7:46pm
 
That number is probably the amount of milliseconds since January 1 1970 ... you could convert it with php: http://www.php.net/manual/en/function.mktime.php
if you only have p55 to calculate it you'll just have to count a lot
Re: can anyone make sense from this, timestamp? da
Reply #2 - Jan 20th, 2007, 8:22pm
 
yep, it's only Procsessing .. i need to call it about 6600 * 4 times. don't wanna spawn into php for that.

i tried:
Code:

long timestamp = 1144340899;
java.util.Date d = new java.util.Date(timestamp);
println( d );

java.sql.Timestamp systemDate = new java.sql.Timestamp(1144340899);
println( systemDate );


which both give totally wrong results ... i still think it's a timestamp, but i can't see how it's encoded. any ideas?

F
Re: can anyone make sense from this, timestamp? da
Reply #3 - Jan 20th, 2007, 8:27pm
 
ok, another thing about it, the int is parsed by an os-x app normally. maybe that gives someone any ideas?

thanks!
F
Re: can anyone make sense from this, timestamp? da
Reply #4 - Jan 20th, 2007, 8:50pm
 
That timestamp is in seconds, not milliseconds. You need:

Code:
long timestamp = 1144340899;
java.util.Date d = new java.util.Date(timestamp*1000);
println( d );
Re: can anyone make sense from this, timestamp? da
Reply #5 - Jan 20th, 2007, 9:03pm
 
ha, perfect.
thanks!

F
Page Index Toggle Pages: 1