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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T00:12:03+00:00 2026-06-07T00:12:03+00:00

I receive a date in the format below from a json file. Im not

  • 0

I receive a date in the format below from a json file. Im not sure but i think its formatted by DataContractJsonSerializer Class in the .Net framework. The date looks like this

    \/Date(1255993200000+0100)\/

I was wondering if anyone would know how i would convert this into normal dates on iOS or if i have to do anything to change it.

Thanks,

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

    Try this

    -(NSDate*)mfDateFromDotNetJSONString:(NSString *)string
    {
        static NSRegularExpression *dateRegEx = nil;
        static dispatch_once_t onceToken;
        dispatch_once(&onceToken, ^{
            dateRegEx = [[NSRegularExpression alloc] initWithPattern:@"^\\/date\\((-?\\d++)(?:([+-])(\\d{2})(\\d{2}))?\\)\\/$" options:NSRegularExpressionCaseInsensitive error:nil];
        });
        NSTextCheckingResult *regexResult = [dateRegEx firstMatchInString:string options:0 range:NSMakeRange(0, [string length])];
    
        if (regexResult)
        {
            // milliseconds
            NSTimeInterval seconds = [[string substringWithRange:[regexResult rangeAtIndex:1]] doubleValue] / 1000.0;
            // timezone offset
            if ([regexResult rangeAtIndex:2].location != NSNotFound) {
                NSString *sign = [string substringWithRange:[regexResult rangeAtIndex:2]];
                // hours
                seconds += [[NSString stringWithFormat:@"%@%@", sign, [string substringWithRange:[regexResult rangeAtIndex:3]]] doubleValue] * 60.0 * 60.0;
                // minutes
                seconds += [[NSString stringWithFormat:@"%@%@", sign, [string substringWithRange:[regexResult rangeAtIndex:4]]] doubleValue] * 60.0;
            }
    
            return [NSDate dateWithTimeIntervalSince1970:seconds];
        }
        return nil;
    }
    

    and pass string using

    [NSString stringWithFormat:...] to this function

    This helped for me and hope it helps you

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

Sidebar

Related Questions

I receive Date and time from CSV file The received Date format is YYYYMMDD
I receive text from a *.csv file in any date format For example: dd/mm/yy
I am trying to format a date into required format. but i receive wrong
I receive this date format from facebook and google docs: 2011-02-25T10:55:25+0000 How can I
I am having a problem with formatting a date that I receive from a
I received a workbook from a colleague who does not use a consistent date
I receive a date-time from automation system like this: 00:00:30:00 . When I try
My problem is that I receive for example a date in a concatenated format:
Below are the date strings received from the server 2012-07-05T11:18:00-04:00 or 2012-12-05T10:26:00-05:00 As far
We currently receive parameters of values as VARCHAR 's, and then build a 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.