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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T16:59:28+00:00 2026-05-14T16:59:28+00:00

I am storing the dates in a SQLite database in this format: d-MMM-yyyy,HH:mm:ss aaa

  • 0

I am storing the dates in a SQLite database in this format:

d-MMM-yyyy,HH:mm:ss aaa

When I retrieve the date with that format I am get every thing fine
except the hour. The hour is always 00. Here is my output:

String date--->29-Apr-2010,13:00:14 PM
After convrting Date--->1272479414000--Thu Apr 29 00:00:14 GMT+05:30 2010

Here is the code:

    Date lScheduledDate = CalendarObj.getTime();
    DateFormat formatter = new SimpleDateFormat("d-MMM-yyyy,HH:mm:ss aaa");
    SomeClassObj.setTime(formatter.format(lScheduledDate));

    String lNextDate = SomeClassObj.getTime();
    DateFormat lFormatter = new SimpleDateFormat("d-MMM-yyyy,HH:mm:ss aaa");
    Date lNextDate = (Date)lFormatter.parse(lNextDate);
    System.out.println("output here"+lNextDate);

What am I doing wrong?

  • 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-05-14T16:59:29+00:00Added an answer on May 14, 2026 at 4:59 pm

    I think your date format does not make sense. There is no 13:00 PM. Remove the “aaa” at the end of your format or turn the HH into hh.

    Nevertheless, this works fine for me:

    String testDate = "29-Apr-2010,13:00:14 PM";
    DateFormat formatter = new SimpleDateFormat("d-MMM-yyyy,HH:mm:ss aaa");
    Date date = formatter.parse(testDate);
    System.out.println(date);
    

    It prints “Thu Apr 29 13:00:14 CEST 2010”.

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

Sidebar

Related Questions

I'm storing a simple java.util.date in an Oracle XE database via hibernate. When testing
I've got this date time string: post[date] = 2007-07-18 10:03:19 I'd like to extract
I'm a little blockheaded right now… I have a date string in european format
I have a string containing a date, and another string containing the date format
Can't understand why the following takes place: String date = 06-04-2007 07:05; SimpleDateFormat fmt
How do I convert a date string, formatted as MM-DD-YY HH:MM:SS , to a
I'm trying to convert a date string into an age. The string is like:
I'm interested in doing comparisons between the date string and the MySQL timestamp. However,
How can I convert a string to a date time object in javascript by
I'm trying to parse a date/time string using DateTime.ParseExact . It works everywhere, except

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.