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

  • Home
  • SEARCH
  • 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 8864191
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:10:44+00:00 2026-06-14T16:10:44+00:00

I am having a date string 2012-11-21 13:11:25 which I get from local database.

  • 0

I am having a date string 2012-11-21 13:11:25 which I get from local database. I have to convert this according to UTC settings and display it on a particular screen. So if its GMT+05:30 it should be displayed as 2012-11-21 18:41:25 on the screen. How can I do this conversion. I have checked some of the questions but that didn’t work out.

I am able to get a Date object that returns something like Wed Nov 21 13:11:25 GMT+05:30 2012 after this I need to get the time as 18:41:25 and date as 11-21-2012

Thanks in advance

  • 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-14T16:10:47+00:00Added an answer on June 14, 2026 at 4:10 pm

    Your df and inputFmt must use the same format.

    But I think you should do it like this:

        Date myDate = new Date();
    
        Calendar calendar = Calendar.getInstance();
        calendar.setTimeZone(TimeZone.getTimeZone("UTC"));
        calendar.setTime(myDate);
        Date time = calendar.getTime();
        SimpleDateFormat outputFmt = new SimpleDateFormat("MMM dd, yyy h:mm a zz");
        String dateAsString = outputFmt.format(time);
        System.out.println(dateAsString);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having a Date String in this format 2012-09-06 04:57:00.000. I need to
I am having a string that returns both date and time from database as
I'm having some trouble using regular expression to get date in a string. Example
I've been trying this from a long time. I'm having today's date and I
Friends I am having a String that contains date-record String date=10-Oct-2012 @12-Oct-2012 @$12-Oct-2012 @12-Oct-2012
I'm having some problems getting a date string (such as 17/08/2012) to a date
I'm having a hard time Parsing/Formatting a Date string received back from a web
I'm having a strange issue converting a string to a date: NSString *goodDateString =
I'm having an issue with date/time formats in ASP.NET/C#. I have my SQL Server
I am having a problem converting a date/time string to an NSDate. The date

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.