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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T06:14:38+00:00 2026-06-11T06:14:38+00:00

there are two string String date = 9/13/2012; String time = 5:48pm; the time

  • 0

there are two string

String date = "9/13/2012";
String time = "5:48pm";

the time is GMT+0, I wanna change it to GMT+8,what is the simplest way to change a time to particular timezone

  • 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-11T06:14:40+00:00Added an answer on June 11, 2026 at 6:14 am
    • Parse it using a SimpleDateFormat set to the UTC time zone
    • Format the parsed Date value using a SimpleDateFormat set to the time zone you’re interested in. (It’s likely to be something other than just “UTC+8” – you should find out which TZDB time zone ID you really want.

    For example:

    SimpleDateFormat inputFormat = new SimpleDateFormat("MM/dd/yyyy h:mma", Locale.US);
    inputFormat.setTimeZone(TimeZone.getTimeZone("Etc/UTC");
    Date date = inputFormat.parse(date + " " + time);
    
    // Or whatever format you want...
    SimpleDateFormat outputFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm", Locale.US);
    outputFormat.setTimeZone(targetTimeZone);
    String outputText = outputFormat.format(date);
    

    (If you can use Joda Time instead, that’d be great – but I understand that it’s pretty big for an Android app.)

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

Sidebar

Related Questions

There are two strings. String str1=Order Number Order Time Trade Number; String str2=Order Tm;
The java.util.Date toString() method displays the date in the local time zone. There are
There are two lists: List<string> excluded = new List<string>() { .pdf, .jpg }; List<string>
Possible Duplicate: Concatenate Two NSDate String values Just confused that is there any default
I wrote two methods to check there performance public class Test1 { private String
Is there a PHP function that grabs the string in between two characters. For
Two models: Invoice :invoice_num string :date datetime . . :disclaimer_num integer (foreign key) Disclaimer
I have following code: string date = 13.04.2012; string date2 = (DateTime.Parse(date).AddDays(1)).ToString(); This is
I have to receive a string representing a date to process through time.strptime in
Here is the code: string s = 2012-08-08T01:54:45.3042880+00:00; JObject j1 = JObject.FromObject(new { time=s

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.