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 8392229
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T19:27:56+00:00 2026-06-09T19:27:56+00:00

I have an application that retrieves a string formatted in date time format from

  • 0

I have an application that retrieves a string formatted in date time format from a database, and I want to display only the time in certain instances, how would I accomplish this?

This is what I have tried so far but I get an Unparsable error

public static final String DATE_TIME_FORMAT = "yyyy-MM-dd kk:mm:ss";
private static final String TIME_FORMAT = "kk:mm";

// ...

SimpleDateFormat TimeFormat = new SimpleDateFormat(TIME_FORMAT);
Date startTimer = null;
Date endTimer = null;

try
{
    String dateString = cursor.getString(6); 
    startTimer = TimeFormat.parse(dateString); 

    //Code for End Time
    String endDateString = cursor.getString(7); 
    endTimer = TimeFormat.parse(endDateString);

    totalBillable += endTimer.getTime() - startTimer.getTime();             
}
catch (ParseException e)
{
    Log.e("ReminderEditActivity", e.getMessage(), e);
}
  • 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-09T19:27:58+00:00Added an answer on June 9, 2026 at 7:27 pm

    I’m guessing that you are getting Unparsable error because you are parsing a string date that has different format. Try this:

    String dateString = cursor.getString(6); 
    startTimer = TimeFormat.parse(dateString.substring(11, 16)); 
    
    String endDateString = cursor.getString(7); 
    endTimer = TimeFormat.parse(endDateString.substring(11, 16));
    

    Hopefully by this substring() method, you will get the kk:mm date format.

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

Sidebar

Related Questions

I have a simple application that retrieves a dataset from the database and converts
I have made an application that displays a lot of questions from my database.
I have an application which connects to a database, retrieves a username from a
Hello frnds I have windows mobile application, that retrieves location info. Now i want
I'm writing a web application that constantly retrieves XML components from a database and
I have an application that gets an api key and account name from a
I have an application that extends a Frame. Then, it'll display a few lines
We have an application that needs to access a database that is owned by
I have an Android application which retrieves from a external server, a name and
I have an application that imports data from a pickled file. It works just

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.