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

Tuesday, January 18, 2022

[FIXED] Select the rows with custom date format in MySQLi

 January 18, 2022     datatables, mysqli, php, phpmyadmin, sql     No comments   

Issue

I want to select the rows with custom date format in MySQLi. Here is the image of my database.

enter image description here

if the `publish_date` is like 1540182298,1540182469,1540183281

$sql="SELECT * FROM new_enquery WHERE date_format(publish_date, '%Y')='2018'";


Solution

Seems unix timestamp so you could try using FROM_UNIXTIME

SELECT * FROM new_enquery WHERE FROM_UNIXTIME(publish_date, '%Y')= '2018'


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