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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T00:31:22+00:00 2026-06-18T00:31:22+00:00

I hava one string 2013-1-31 08:25 PM i want to split from space and

  • 0

I hava one string “2013-1-31 08:25 PM”

i want to split from space and :

i able to split after space it become “2013-1-31 08” and “25 PM”

now i want the “2013-1-31” and “08”

i dont not able to get the value in the 08 in the new string but i get the “2013-1-31”

String view_datee = view_date.getText().toString();

               String[] separated = view_datee.split(":");
               String first =separated[0];
               String second=separated[1]; 


               String[] newSeperated = first.split(" ");
               String third = newSeperated[0]; 
               String four=   newSeperated[1];



               Log.i("first",first);
               Log.i("second",second);

               Log.i("third", third);
               Log.i("four", four);

I do not how to get the four value means 08 .

  • 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-18T00:31:23+00:00Added an answer on June 18, 2026 at 12:31 am

    Here is an example using a date / calendar (it uses desktop java but easily transposable):

    public static void main(String args[]) throws Exception {
        String data = "2013-1-31 08:25 PM";
        DateFormat fmt = new SimpleDateFormat("yyyy-MM-dd hh:mm a");
        Calendar cal = Calendar.getInstance();
        cal.setTime(fmt.parse(data));
        //2013-1-31
        System.out.println(new SimpleDateFormat("yyyy-M-dd").format(cal.getTime()));
        //20
        System.out.println(cal.get(Calendar.HOUR_OF_DAY));
        //08
        System.out.println(new SimpleDateFormat("hh").format(cal.getTime()));
    }
    

    Note that 08:25 PM is 20:05 so you can get either 08 or 20 depending on what you need. I showed both in my example.

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

Sidebar

Related Questions

I hava a UITextView ,and after some characters' input, I want to use a
I hava a Transaction datatable with Amount field. I want to get Sum (Amount)
I hava a webview showing some contents which is getting from server. Now on
I hava a ListBox and Binding Students,I want to get ID when I Click
I hava access DB, one of my function(C#.net) need to Exec a SQL more
I hava a Bitmap variable named bmp in Activity1 , and I want to
I hava a class called DBhelper, and now I created a new class called
i hava a c++ method(for java,jni) like follow,when i repeat call this from java
I hava a problem with an error in ADT Plugin. I want to make
I'm borrowing the slice meaning from C++. Let's say I hava a simple POJO

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.