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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T10:07:20+00:00 2026-05-27T10:07:20+00:00

For a certain API I am getting dates in a /Date(1323312018479-0700)/ format. For some

  • 0

For a certain API I am getting dates in a /Date(1323312018479-0700)/ format. For some reason the regex that I am using does not result in any matches.

Any ideas?

BTW: I am not taking into account the timezone right now.

public static Date parseApiDate(String rawDate) {
    Pattern p = Pattern.compile("([0-9]+)-([0-9]+)", Pattern.CASE_INSENSITIVE);
    Matcher m = p.matcher(rawDate);

    Log.d("DATE CONVERSION: Raw", rawDate);
    if (m.matches()) {
        String utc = m.group(1);
        int milliSeconds = Integer.parseInt(utc);
        Date date = new Date(milliSeconds);

        Log.d("DATE CONVERSION: milliseconds", utc);
        Log.d("DATE CONVERSION: Converted", date.toGMTString());

        return date;
    } else {    
        return new Date(0);
    }
}
  • 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-05-27T10:07:21+00:00Added an answer on May 27, 2026 at 10:07 am

    You need m.find() instead of m.matches(). Then you’d need Long.parseLong()

    Generally, you should parse dates with DateFormat (SimpleDateFormat), but in this case it can’t cope. The pattern SZ fails, perhaps because it is not sure where the timezone starts (although it should be able to do that)

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

Sidebar

Related Questions

I was reading that certain API's are not available when making iPhone apps with
I have an API that is dependent on certain state information between requests. As
Say you have an API that is not accessible to change: List<LegacyObject> getImportantThingFromDatabase(Criteria c);
I'm having trouble using python function decorators in Google's AppEngine. I'm not that familiar
I'm working on an app that uses a certain webapp's API. The API requiers
I'm just getting started with the Salesforce Web Services API and I'm surprised that
I'm using the BLogger API (google) to try and search for certain strings (i.e.'John
I've got some code that uses the regular Forms API to put together a
I am writing an API that returns all Users that fit a certain criteria
I'm writing a Facebook application that accesses the user's friends' photos. For some reason,

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.