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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T17:11:07+00:00 2026-06-07T17:11:07+00:00

I have a date string: gridcell.setTag(theday + – + themonth + – + theyear

  • 0

I have a date string:

gridcell.setTag(theday + "-" + themonth + "-" + theyear + "|" + hijri_day + "-" + hijri_month + " ("+ hijri_monthno +") " + hijri_year);

..which I pass on to another class on button click if the date has an event:

String date_month_year = (String) view.getTag();
if (isHoliday(d, m, y))
{
    Intent i = new Intent(view.getContext(), Events.class);
    i.putExtra("date_string", date_month_year);
    startActivity(i);
}

In the Events.class, I get the parameters:

Intent intent = getIntent();
String date_string = intent.getStringExtra("date_string");

date_view = (TextView) this.findViewById(R.id.hijridate);
eventdetails = (TextView) this.findViewById(R.id.eventdetails);
date_view.setText(date_string);


String[] dateAr = date_string.split("-|\\||\\(|\\)|\\s+");
m = Integer.parseInt(dateAr[6]);
d = Integer.parseInt(dateAr[3]);
y = Integer.parseInt(dateAr[8]);

This is the Hijri month array:

private String months[] = {"Muharram","Safar","Rabi-al Awwal","Rabi-al Thani","Jumada al-Ula","Jumada al-Thani","Rajab","Sha\'ban","Ramadhan","Shawwal","Dhul Qa\'dah","Dhul Hijjah"};

The problem I’m having is that when it’s a one word month name (i.e. Muharram, Safar, Rajab, etc. .) everything works smoothly. However, if it’s a word with a space or a dash (i.e. Rabi-al awwal, Dhul Hijjah), it throws the error: NumberFormatException: unable to parse '' as integer or NumberFormatException: unable to parse 'al' as integer

What am I doing 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-07T17:11:08+00:00Added an answer on June 7, 2026 at 5:11 pm

    Is there a reason you need to use a lot of different character types to split the string on?

    The reason it’s failing is because the split characters your using at

    String[] dateAr = data_string.split(“-|\||\(|\)|\s+”);

    are also in the month name.

    put a debug point after that line, or do a for each over the dateAr array and log the results. That way, you can understand how it’s being split.

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

Sidebar

Related Questions

I have a date string which looks like this: Thu Feb 09 2012 01:50:00
I have a date as a string: var mydate = 05/05/2011 when I pass
I have javascript date object which gives me a date string in this format,
I have a date string as follows: Fri, 17 Jun 2011 19:20:51 PDT which
I have date as a string 16/11/2010 12:00:00 AM for example which I am
I have this date as string with me 15-07-2011 which is in the format
I have a date which is saved in a regular string. // format =
I have a date string, returned from a ExtJS datetime picker, which looks like
I have a date string of the form '2009/05/13 19:19:30 -0400'. It seems that
I have a date string and I want to parse it to normal date

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.