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 & HelpSyntax Questions › Unix epoch to simple date converter
Page Index Toggle Pages: 1
Unix epoch to simple date converter? (Read 1325 times)
Unix epoch to simple date converter?
Nov 22nd, 2008, 10:50pm
 
Hey everyone,

I've been looking around, but I am having a hard time trying to figure out how to easily change from Unix epoch time to a format that is legible for us humans =)

The problem is have a a large set of data with unix time stamps, and I want to let the user select begin/end dates.

How can I best switch between different date/time formats?
Re: Unix epoch to simple date converter?
Reply #1 - Nov 22nd, 2008, 11:10pm
 
I've answered my own question I guess, this is what I found:

=========

int epoch = 1225359677;

String date = new java.text.SimpleDateFormat("dd/MM/yyyy").format(new java.util.Date (epoch*1000L));

print(date);

=========

anyone know of something better?
Re: Unix epoch to simple date converter?
Reply #2 - Jul 21st, 2009, 3:58pm
 
1) Thanks for your sample!
2) How can I get the unix timestamp to be formatted as UTC time?
Re: Unix epoch to simple date converter?
Reply #3 - Jul 22nd, 2009, 1:03am
 
Look at SimpleDateFormat.
Page Index Toggle Pages: 1