1
I have on my bench a field with timestamp datetime
and I need to convert the timestamp
for this format example:
WEDNESDAY, DECEMBER 31, 1969 posted at 3:30 pm
I searched here and found a code, but I can’t make it work it returns an error:
setlocale(LC_ALL, 'pt_BR', 'pt_BR.utf-8', 'pt_BR.utf-8', 'portuguese');
date_default_timezone_set('America/Sao_Paulo');
$var_DateTime = $dd;
return utf8_encode(ucwords(strftime('%A', $var_DateTime->sec)).', '
.strftime('%d', $var_DateTime->sec).
' de '.ucwords(strftime('%B', $var_DateTime->sec))
.' de '.strftime('%Y', $var_DateTime->sec));
How to format this date?
gave the emsmo error NOTICE: TRYING TO GET PROPERTY OF NON-OBJECT IN E: WAMP64 WWW DAGAZ SITE ESSENCIALS CONNECTION.INC.PHP ON LINE 170
– Jasar Orion
My team Stamp this so 2016-10-25 22:36:52
– Jasar Orion
the error has nothing to do with this code, it’s saying that
$var_DateTime
it’s not an object, so it can’t get the propertysec
– Ricardo Moraleida
What Ricardo said is true. You have to better contextualize the question if it’s not the problem in question @Jasarorion. His code would work correctly. I just think it might be unnecessary to use
utf8_encode
in this case, but is the solution to your date problem.– Wallace Maxters
I believe, then, by comment, could correct this response by transforming the value for the respective type of data (
DateTime
) as far as I could make out.– novic
And what would be according to the Stamp team that is in db ? and $var_DateTime->sec if I put only $var_DateTime it says it is not a valid date. ( non well Formed number )
– Jasar Orion
Puts
var_dump( $var_DateTime );
just before thereturn
and glue here what he prints on canvas.– Ricardo Moraleida