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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T21:22:52+00:00 2026-06-04T21:22:52+00:00

Server sends me time like this: 2012-06-08 17:00:00 +0100 I need to change it

  • 0

Server sends me time like this:

2012-06-08 17:00:00 +0100

I need to change it like HH:MM based on local time. For example this time is what time at Japan, India, US and etc.

How can I do this? Thanks

  • 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-04T21:22:53+00:00Added an answer on June 4, 2026 at 9:22 pm

    Option 1: using java.util.Date/Calendar:

    First you need to parse the value to a Date, then reformat it in the format and time zone
    you’re interested in:

    SimpleDateFormat inputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss z",
                                                        Locale.US);
    Date date = inputFormat.parse(inputText);
    
    // Potentially use the default locale. This will use the local time zone already.
    SimpleDateFormat outputFormat = new SimpleDateFormat("HH:mm", Locale.US);
    String outputText = outputFormat.format(date);
    

    Option 2: using Joda Time

    Joda Time is a much better date/time library for Java.

    DateTimeFormatter inputFormatter = DateTimeFormat
        .forPattern("yyyy-MM-dd HH:mm:ss Z")
        .withLocale(Locale.US);
    
    DateTime parsed = inputFormatter.parseDateTime(inputText);
    
    DateTimeFormatter outputFormatter = DateTimeFormat
        .forPattern("HH:mm")
        .withLocale(Locale.US)
        .withZone(DateTimeZone.getDefault());
    
    String outputText = outputFormatter.print(parsed);
    

    Note that you should only convert to/from string representations when you really need to. Otherwise, use the most appropriate type based on your usage – this is where Joda Time really shines.

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

Sidebar

Related Questions

I'm studying Unix sockets programming. I made a time server that sends raw time
I’m writing a server/client game, a typical scenario looks like this: one client (clientA)
My server sends me time zones of the format America/Los Angeles. On the client,
I would like to use libev for a streaming server I am writing. This
I am building an HTTP client based on the example on HTTP server given
Is it normal firebird server sends all registered event counts on raising any of
When a server sends UTF-8 bytes, how do you read them without characters becoming
Here is what I am trying to do: The server sends message to connected
I'm sending some data to an external URL using Curl. The server sends me
i build a server that sends questions to clients depending on the cells they

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.