mardi 31 octobre 2017

Strtotime is not converting all dates?

I have a json response like this:

{
    "count": 9,
    "facebook": [
        {
            "description": "Calling all Fitness Instructors... Are you already thinking about your next course to study in 2018? Read on... We deliver courses that you can take away and teach the day after! We are proud of our specialist tutors and face to face training. Meet like minded fitness professionals, share ideas and network.",
            "time": "2017-10-29T12:22:47+0000",
            "image": "http://ift.tt/2A2LKha",
            "link": "http://ift.tt/2xGbLS3"
        },
        {
            "description": "Calling all Fitness Instructors... Are you already thinking about your next course to study in 2018? Read on... We deliver courses that you can take away and teach the day after! We are proud of our specialist tutors and face to face training. Meet like minded fitness professionals, share ideas and network.",
            "time": "2017-10-15T09:59:25+0000",
            "image": "http://ift.tt/2A2LKha",
            "link": "http://ift.tt/2xGbLS3"
        },
        {
            "description": "Really excited after our call with Fitness Professionals. Look out for our partnership with Fitpro very soon 🎉🎉🎉 this means discounts and offers for Trained Academy Graduates 🎓",
            "time": "2017-10-11T14:57:12+0000",
            "image": "http://ift.tt/2A2LKha",
            "link": "http://ift.tt/2xGbLS3"
        },
        {
            "description": "Really excited after our call with Fitness Professionals. Look out for our partnership with Fitpro very soon 🎉🎉🎉 this means discounts and offers for Trained Academy Graduates 🎓",
            "time": "2017-10-10T06:12:26+0000",
            "image": "http://ift.tt/2A2Q0x6",
            "link": "http://ift.tt/2xH9y8R"
        },
        {
            "description": "16-18? Jump into a #personaltraining #career! Started college and decided it’s not for you? \n\nWant to be a Gym Instructor? Circuit Trainer? 🏋🏻\nOr work towards a career in the Fire Service? 🔥 \n\nJoin us Weds night for open enrolment or careers advice from @paulalitherland and @nickyjanew  \n@mahdloyouthzone 6:30pm Wednesday 11th October. \n\nFully Funded for 16-18 year olds \nUCAS accredited \nIndustry recognised L2 Gym / L3 PT\nExclusive discounts using your Fire Team badge \nFree food box @chiaproteinbar \nWork placements @thegymgroup",
            "time": "2017-10-08T04:49:42+0000",
            "image": "http://ift.tt/2A3swIb",
            "link": "http://ift.tt/2xGbMW7"
        },
        {
            "description": "#trainedacademy #team @mahdloyouthzone preparing marketing material for 2018 enrolments. #oldhamfitness #oldham #practical #learningenhanced #alevels #employability @gymcareer @thegymgroup @chiaproteinbar",
            "time": "2017-10-06T07:48:20+0000",
            "image": "http://ift.tt/2A33o4y",
            "link": "http://ift.tt/2xGbNt9"
        },
        {
            "description": "Looking for an Exercise to Music Course? Our new tutor Becky Jackson can’t wait to set some dates. Let us know if you’re ready! 💕",
            "time": "2017-10-05T04:22:11+0000",
            "image": "http://ift.tt/2A33o4y",
            "link": "http://ift.tt/2xGbNt9"
        },
        {
            "description": "Looking for an Exercise to Music Course? Our new tutor Becky Jackson can’t wait to set some dates. Let us know if you’re ready! 💕",
            "time": "2017-10-04T06:05:44+0000",
            "image": "http://ift.tt/2A1NxD3",
            "link": "http://ift.tt/2xH9BBz"
        },
        {
            "description": "We are excited to launch our next teacher training qualification with the amazing Jeanette Smout. \n\nBook before 30th Oct as the price is wrong 🤦🏻‍♀️ should be £450 as it’s now 3 days face to face training. Could you be one of our future tutors?? 🤗",
            "time": "2017-10-04T05:57:14+0000",
            "image": "http://ift.tt/2A1NxD3",
            "link": "http://ift.tt/2xH9BBz"
        }
    ]
}

However, when I add date and strtotime like this:

   $date = date('l, jS F, Y h:ia', strtotime($rawDate));

Then result is like this:

{
    "count": 9,
    "facebook": [
        {
            "description": "Calling all Fitness Instructors... Are you already thinking about your next course to study in 2018? Read on... We deliver courses that you can take away and teach the day after! We are proud of our specialist tutors and face to face training. Meet like minded fitness professionals, share ideas and network.",
            "time": "Sunday 29th October 12:22pm",
            "image": "http://ift.tt/2A0HTRH",
            "link": "http://ift.tt/2xH9Dtb"
        },
        {
            "description": "Calling all Fitness Instructors... Are you already thinking about your next course to study in 2018? Read on... We deliver courses that you can take away and teach the day after! We are proud of our specialist tutors and face to face training. Meet like minded fitness professionals, share ideas and network.",
            "time": "2017-10-15T09:59:25+0000",
            "image": "http://ift.tt/2A0HTRH",
            "link": "http://ift.tt/2xH9Dtb"
        },
        {
            "description": "Really excited after our call with Fitness Professionals. Look out for our partnership with Fitpro very soon 🎉🎉🎉 this means discounts and offers for Trained Academy Graduates 🎓",
            "time": "Wednesday 11th October 03:57pm",
            "image": "http://ift.tt/2A0HTRH",
            "link": "http://ift.tt/2xH9Dtb"
        },
        {
            "description": "Really excited after our call with Fitness Professionals. Look out for our partnership with Fitpro very soon 🎉🎉🎉 this means discounts and offers for Trained Academy Graduates 🎓",
            "time": "2017-10-10T06:12:26+0000",
            "image": "http://ift.tt/2A2Q0x6",
            "link": "http://ift.tt/2xH9y8R"
        },
        {
            "description": "16-18? Jump into a #personaltraining #career! Started college and decided it’s not for you? \n\nWant to be a Gym Instructor? Circuit Trainer? 🏋🏻\nOr work towards a career in the Fire Service? 🔥 \n\nJoin us Weds night for open enrolment or careers advice from @paulalitherland and @nickyjanew  \n@mahdloyouthzone 6:30pm Wednesday 11th October. \n\nFully Funded for 16-18 year olds \nUCAS accredited \nIndustry recognised L2 Gym / L3 PT\nExclusive discounts using your Fire Team badge \nFree food box @chiaproteinbar \nWork placements @thegymgroup",
            "time": "Sunday 8th October 05:49am",
            "image": "http://ift.tt/2A3swIb",
            "link": "http://ift.tt/2xGbMW7"
        },
        {
            "description": "#trainedacademy #team @mahdloyouthzone preparing marketing material for 2018 enrolments. #oldhamfitness #oldham #practical #learningenhanced #alevels #employability @gymcareer @thegymgroup @chiaproteinbar",
            "time": "Friday 6th October 08:48am",
            "image": "http://ift.tt/2A33o4y",
            "link": "http://ift.tt/2xGbNt9"
        },
        {
            "description": "Looking for an Exercise to Music Course? Our new tutor Becky Jackson can’t wait to set some dates. Let us know if you’re ready! 💕",
            "time": "Thursday 5th October 05:22am",
            "image": "http://ift.tt/2A33o4y",
            "link": "http://ift.tt/2xGbNt9"
        },
        {
            "description": "Looking for an Exercise to Music Course? Our new tutor Becky Jackson can’t wait to set some dates. Let us know if you’re ready! 💕",
            "time": "2017-10-04T06:05:44+0000",
            "image": "http://ift.tt/2A1NxD3",
            "link": "http://ift.tt/2xH9BBz"
        },
        {
            "description": "We are excited to launch our next teacher training qualification with the amazing Jeanette Smout. \n\nBook before 30th Oct as the price is wrong 🤦🏻‍♀️ should be £450 as it’s now 3 days face to face training. Could you be one of our future tutors?? 🤗",
            "time": "Wednesday 4th October 06:57am",
            "image": "http://ift.tt/2A1NxD3",
            "link": "http://ift.tt/2xH9BBz"
        }
    ]
}

So as you can see above some of the date are not being converted to human readable dates, why is this happening? is there something wrong with my code? Or is that a problem with the JSON i am retrieving?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2A4mhnx
via IFTTT

Aucun commentaire:

Enregistrer un commentaire