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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T08:05:07+00:00 2026-06-01T08:05:07+00:00

Today I got a project written in PHP. There’s an error when I try

  • 0

Today I got a project written in PHP. There’s an error when I try to show a date in a table data set. This is the statement that generates the error:

$data = new DateTime($registro["previsao de entrega"];

The error message is this:

Fatal error: Uncaught exception ‘Exception’ with message
‘DateTime::__construct() Failed to parse time string (2 dez 2011
16:00) at position 0 (2): Unexpected character’ in
C:\www\fluxo_producao\Telas\TelaFluxoProducao.php:941 Stack trace: #0
C:\www\fluxo_producao\Telas\TelaFluxoProducao.php(941):
DateTime->__construct(‘2 dez 2011 16:0…’) #1 {main} thrown in
C:\www\fluxo_producao\Telas\TelaFluxoProducao.php on line 941

What I discovered by myself was that if I change the parameter manually to “12 Dec 2006” for example, the function works. But the date the variable is passing is “12 Dez 2006” (Brazilian format, by the way, I’m Brazilian ^_^), and i found too that the default timezone in the server is “America/Sao_Paulo”… What do I have to change in the function or parameters to make it convert the format specified?

  • 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-01T08:05:09+00:00Added an answer on June 1, 2026 at 8:05 am

    Verify that you have set your server to the correct time locale:

    setlocale(LC_TIME, 'pt_BR');
    

    This is required for strftime() and AFAIK all the date/time related functions and the DateTime class use the same library which will require/respect this setting.

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

Sidebar

Related Questions

I got this error today when trying to open a Visual Studio 2008 project
Got this error today while trying to build a project with checkstyle. This works
Today I got this question for which I think I answered very bad. I
Today I've got a stacktrace with a very strange error. Actually, I may be
I got an error today while trying to do some formatting to existing code.
I've got a repository on GitHub ( http://github.com/hrickards/PHP-Crypto ) for a little project me
I've done this hundreds of times before without issue, but today I've got a
today i was facing a strange problem: got a 'missing method' error on a
We just got a midterm project today for my operating systems course, we are
Today I got my book Head First Design Patterns in the mail. Pretty interesting

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.