PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, January 26, 2022

[FIXED] Convert data in Laravel 5.8 dive wrong result

 January 26, 2022     laravel, laravel-5, php     No comments   

Issue

I am beginner in Laravel. I use in my project Laravel 5.8. I have this code:

$dataTimeFromDb = '2019-12-28T23:54:04.000000Z';
$userLastActivity = Carbon::parse($dataTimeFromDb)->format('Y-m-d H:m');

In result I have: 2019-12-29 00:12.

I need value from DB in format: Y-m-d H:m. My timezone is Warsaw/Berlin and I save in this format in DB.

How can I repeir it?


Solution

I think using format only can do the trick. Try it and let me know.

$dataTimeFromDb->format('Y-m-d H:i')


Answered By - Marios Nikolaou
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing