Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7945097
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T00:45:16+00:00 2026-06-04T00:45:16+00:00

I’m receiving some date format, an ISO-something, and was wondering what the appropriate way

  • 0

I’m receiving some date format, an ISO-something, and was wondering what the appropriate way to parse it into a timestamp.

My ultimate goal will be a standard switch on it to create “X minutes / hours / days ago.”, so if there is a tool that does that already, that’d be optimal.

I’ve tried joda-time, but it choked on it.

Here is an example of a time string:

2012-05-03 @ 15.55.05.433Z

Additionally, if it is indeed it is the case that it’s not an ISO-something format, I’ve no problem manipulating, say, the @ out of it, etc.

EDIT: Attempt 1:

SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.SSSZ" );

try
{
  Date myDate = dateFormat.parse( o.getCreationDate().replace( "@", "" ) );

  long minutes = myDate.getTime() / 1000 / 60;

  holder.timeText.setText( minutes + " minutes ago" );
}
catch( ParseException e )
{
  e.printStackTrace();
}

Result:

05-17 16:58:05.003: W/System.err(2915): java.text.ParseException: Unparseable date: "2012-05-09 19:49:47.987Z" (at offset 24)

EDIT 2: Stripping the Z, and correct millisecond to minute conversion fixed it:

SimpleDateFormat dateFormat = new SimpleDateFormat( "yyyy-MM-dd HH:mm:ss.SSS" );

try
{
  Date myDate = dateFormat.parse( o.getCreationDate().replace( "@ ", "" ).replace( "Z", "" ) );

  Date now = new Date();

  long minutes = ( now.getTime() - myDate.getTime() ) / 1000 / 60;

  holder.timeText.setText( minutes + " minutes ago" );
}
catch( ParseException e )
{
  e.printStackTrace();
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T00:45:17+00:00Added an answer on June 4, 2026 at 12:45 am

    First remove the @ character, then create an instance of SimpleDateFormat that will parse your string and return a Date object which will enable you to get the timestamp you desire.

    String myStringDate = "2012-05-03 @ 15.55.05.433Z";
           myStringDate = myStringDate.replace("@ ","");   //Also removes extra whitespace  
    
    SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSSZ");
    Date myDate = dateFormat.parse("your date string");
         myDate.getTime(); //Your timestamp in milliseconds
    

    Note you’ll need to surround with a try and catch since it can throw an exception.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
I have a French site that I want to parse, but am running into
I have just tried to save a simple *.rtf file with some websites and
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an ’ in it. SimpleXML turns this
I am currently running into a problem where an element is coming back from
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti
i want to parse a xhtml file and display in UITableView. what is the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.