-3

In android phone, time showing like (01:15 a.m.). Due to this time behaviour, I am facing data sync issues on server. Is there any way to set this time to 01:15 am.

NOTE I have tried replace function and I got right result, but in my timing calculations it is not working.

Please suggest solution like on OS level so that I can make it right in core date function, if possible.

Mobile name is alcatel, which is creating this issue.

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Syed Hamza Hassan
  • 710
  • 1
  • 11
  • 24
  • What makes you think that your data sync issues come from how the phone displays the time? Those ought to be unrelated. – Ole V.V. Dec 26 '17 at 20:42
  • How are you synchrinizing your data (or trying to)? What are the issues with it? If you are seeing any error message, please quote it. Also, what has Java got to do with this question? Asking because it is tagged java. – Ole V.V. Dec 26 '17 at 20:44
  • It could sound like a locale problem. – Ole V.V. Dec 26 '17 at 20:50
  • Thanks for showing interest. Actually, when I sync data to server in Oracle it does not accept this format like a.m., if I replace these dots with empty then when I do timer calculation it behaves abnormal because money return a.m. while I have edited it to am by replacing dots with empty. Java is linked because it might be any way to set this format in OS or in library which is Java based. – Syed Hamza Hassan Dec 26 '17 at 20:51
  • No, it is not locale problem, because mobile is showing his date in a.m. and p.m. instead of am and pm. – Syed Hamza Hassan Dec 26 '17 at 20:53
  • 1
    Your Question is unclear. And almost certainly a duplicate. Have you bothered to search and study the hundreds of Questions and Answers already posted on this topic? Edit your Question to explain how it is unique. – Basil Bourque Dec 26 '17 at 21:39
  • 1
    @OleV.V., You were right, It was locale issue, Thank you for your answer. I have changed my locale and it is working fine. – Syed Hamza Hassan Dec 27 '17 at 05:57
  • @Basil, Issue has revolved, by change Locale to English. Thank you for your responses. – Syed Hamza Hassan Dec 27 '17 at 06:00

1 Answers1

1

From this question: displaying AM and PM in small letter after date formatting

An answer showing how to replace the A.M./P.M. strings with whatever text you want.

public class Timeis {
    public static void main(String s[]) {
        long ts = 1022895271767L;
        SimpleDateFormat sdf = new SimpleDateFormat(" MMM d 'at' hh:mm a");
        // CREATE DateFormatSymbols WITH ALL SYMBOLS FROM (DEFAULT) Locale
        DateFormatSymbols symbols = new DateFormatSymbols(Locale.getDefault());
        // OVERRIDE SOME symbols WHILE RETAINING OTHERS
        symbols.setAmPmStrings(new String[] { "am", "pm" });
        sdf.setDateFormatSymbols(symbols);
        String st = sdf.format(ts);
        System.out.println("time is " + st);
    }
}
Nicholas Hirras
  • 2,592
  • 2
  • 21
  • 28