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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T04:17:24+00:00 2026-06-15T04:17:24+00:00

How to convert newyork timezone time to Asia/Kolkata date and time? my Input String:

  • 0

How to convert newyork timezone time to “Asia/Kolkata” date and time?

my Input String:

11/28/2012 8:59am

My code:

String dtStart = "11/28/2012 8:59am";  
        SimpleDateFormat  format = new SimpleDateFormat("mm/dd/yyyy hh:mma");  
        format.setTimeZone(TimeZone.getTimeZone("America/New_York"));
        try {  
            Date date = format.parse(dtStart); 
            Log.i("clock", date.toString());
            System.out.println(date);


            Calendar cal = Calendar.getInstance();
            cal.setTimeInMillis(date.getTime());
            cal.setTimeZone(TimeZone.getTimeZone("Asia/Kolkata"));
            int chour = cal.get(Calendar.HOUR_OF_DAY);
            int cminute = cal.get(Calendar.MINUTE);
            int dd = cal.get(Calendar.DAY_OF_MONTH);
            int mm =cal.get(Calendar.MONTH);
            int yy =cal.get(Calendar.YEAR);

            String mode="AM";

            if(chour>12)
            {
                chour=chour-12;
                mode="PM";
            }

            String mytime=Integer.toString(chour)+":"+Integer.toString(cminute)+" "+mode;
            String mydate=Integer.toString(dd)+"/"+Integer.toString(mm)+"/"+Integer.toString(yy);

            Log.i("clock", mytime);
            Log.i("clock", mydate);

        } catch (ParseException e) {  
            e.printStackTrace();  
        } catch (java.text.ParseException e) {
            e.printStackTrace();
        }

My output Log:

Sat Jan 28 19:29:00 GMT+05:30 2012
7:29 PM
28/0/2012

Here my time is correct,but date is wrong. I expect 28/11/2012.I am not able trace where i did 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-06-15T04:17:25+00:00Added an answer on June 15, 2026 at 4:17 am

    the issue is in format you entered: "mm/dd/yyyy hh:mma". I believe you wanted to do this: "MM/dd/yyyy hh:mma"

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

Sidebar

Related Questions

To convert a date from string to Unix time, I can use date --date
How do I convert a date/time string (e.g. 2011-01-01 15:00:00) that is UTC to
All, How can I convert to a unix timestamp to date and time in
I'm using the following lines of code to convert the unix time I'm getting
convert datetime format yyyy-mm-dd hh:mm:ss (Might be a string) into UTC, Looking into DateTime
consider am having the string date and time. say var selfwDepDate = document.forms[0].fwDepartureDate.value; var
I convert some string in UTF8, and I watch it on browser with UTF-8
i convert an image to base64 string to upload through HttpWebRequest in c#.on server
How convert PST Unix timestamp to UTC and then to any custom time zone
convert MM-DD-YYYY TO MMDDYYYY infopath so for example date: 05-05-2011 would be 05052011 in

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.