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

Sunday, January 16, 2022

[FIXED] how to change longtext a:3:{s:4:"year";s:4:"2018";s:5:"month";s:2:"07";s:3:"day";s:2:"05";} to date 2018-07-05

 January 16, 2022     cakephp, cakephp-3.0, date, datetime, php     No comments   

Issue

Hi I am using cakephp3 and saving data in key-value pair but not able to convert this

a:3:{s:4:"year";s:4:"2018";s:5:"month";s:2:"07";s:3:"day";s:2:"05";}

and result i want in this form

date 2018-07-05

in php


Solution

Give a try with below

$date = unserialize('a:3:s:4:"year";s:4:"2018";s:5:"month";s:2:"07";s:3:"day";s:2:"05";}');

echo 'date '.$date['year'].'-'.$date['month'].'-'.$date['day']; //date 2018-07-05


Answered By - shubhangee
  • 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