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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T15:57:27+00:00 2026-05-31T15:57:27+00:00

I’m working on a PHP script for WordPress and I’m making an API call

  • 0

I’m working on a PHP script for WordPress and I’m making an API call to our system and it includes a .Net to Json formatted DateTime string. Using regular expressions I have stripped it down to the seconds since the Unix Epoch. As I understand, I should be able to then create a DateTime object from that using DateTime::createFromFormat(‘U’, $time); but the script ceases its execution when it encounters it (it executes everything up to that point). I wrapped it in a try/catch but even that’s not being executed, it just simply ‘dies’, I guess.

What’s going on here?

preg_match_all('/\d+/', $post->discussion->posttime, &$ms);
$ms = $ms[0];
var_dump($ms[0]);
$time = substr($ms[0], 0, strlen($ms[0]) - 3);
var_dump($time);
$date = DateTime::createFromFormat('U', $time);
//Nothing after the above line is executed
var_dump($date);
...

Output to the page looks like:

string(13) "1332244919776" 
string(10) "1332244919"

Nothing I put after the DateTime line is displayed (or as far as I can tell, executed). I’ve used valid Unix Timestamps from online and it still doesn’t work. I’ve tried other formats as well (‘Y-m-d’) with matching date string formats and none of them have worked. Creating a regular ‘now’ DateTime object using new DateTime(); works though.

  • 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-31T15:57:29+00:00Added an answer on May 31, 2026 at 3:57 pm

    That sounds like a fatal error with error reporting off.

    The most likely cause of the problem is that you are using a version of php < 5.3. Support for createFromFormat was added in version 5.3 while the DateTime object was added in version 5.2.

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

Sidebar

Related Questions

I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm using v2.0 of ClassTextile.php, with the following call: $testimonial_text = $textile->TextileRestricted($_POST['testimonial']); ... and
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
I'm making a simple page using Google Maps API 3. My first. One marker
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I would like to count the length of a string with PHP. The string
this is what i have right now Drawing an RSS feed into the php,
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
We're building an app, our first using Rails 3, and we're having to build

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.