How to get results comparing only the day and month, ignoring the time of a timestamp?

EnexoOnoma

I would like to display some results (fields like name, description etc) from my database comparing a selected date with the timestamp of the rows in the database.

In my database, the field start has this form of timestamp 2013-07-30 23:00:00. When I search through a form, the $selected date has the same format like 2013-07-30 13:50:00

However, I want to display results that match the same day and month, ignoring the time but I do not know how to do it using PDO statements. like comparing the 2013-07-30 only.

I have connected my database and can perform very basic queries through examples.

Thank you.

invisal

Did you try something like this?

$sh = $db->prepare('SELECT * FROM table WHERE DATE(`start`) = DATE(:start)');
$sh->bindValue(":start", $selected);
$sh->execute();

이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.

침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제

에서 수정
0

몇 마디 만하겠습니다

0리뷰
로그인참여 후 검토

관련 기사

분류에서Dev

Matching value on date (year, month, day) but not time

분류에서Dev

Group by Date -Month -Day Hour and Time Query

분류에서Dev

python convert timestamp without year-month-day

분류에서Dev

How to display data for a certain period of time (day / week / month) from Mysql table in html table (php)

분류에서Dev

Query to get the first day of the month not working with DATEADD

분류에서Dev

Get Month, Day, Year, Day of week from NSString

분류에서Dev

PHP convert time, day,month and year to a formatted string

분류에서Dev

MySQL get next day & time combination

분류에서Dev

How to set system time from Unix timestamp

분류에서Dev

how to convert a timestamp_t to a real time?

분류에서Dev

How to pull day of month from Column header including row data?

분류에서Dev

How can I combine fixed month and day with sql year function?

분류에서Dev

Design a query for SSRS report to switch between hour, day and month time period grouping

분류에서Dev

how to Store the Calender Remainder on Day with time in android

분류에서Dev

how to Store the Calender Remainder on Day with time in android

분류에서Dev

Fullcalendar - How to add time of the day in week view

분류에서Dev

Automatically get the time taking day light saving hours into account

분류에서Dev

Convert julian day to day/month/year

분류에서Dev

sql - year day to day/month conversion

분류에서Dev

How to get longest streak day and average day in Java / Groovy?

분류에서Dev

Adding a month to a date. Setting day to last day of given month

분류에서Dev

How to extract only datein ddmmyy format from a timestamp

분류에서Dev

Loading timestamp upon page load and comparing it to timestamp upon form submit

분류에서Dev

Match whole day in SQLite Timestamp

분류에서Dev

Comparing to undefined not working every time

분류에서Dev

How to parse through a table to gather tide value at a certain time of day

분류에서Dev

Extract year and month from timestamp(6)

분류에서Dev

change the timestamp to next coming month and keeping the date as it is

분류에서Dev

How to get the boot time of Ubuntu?

Related 관련 기사

  1. 1

    Matching value on date (year, month, day) but not time

  2. 2

    Group by Date -Month -Day Hour and Time Query

  3. 3

    python convert timestamp without year-month-day

  4. 4

    How to display data for a certain period of time (day / week / month) from Mysql table in html table (php)

  5. 5

    Query to get the first day of the month not working with DATEADD

  6. 6

    Get Month, Day, Year, Day of week from NSString

  7. 7

    PHP convert time, day,month and year to a formatted string

  8. 8

    MySQL get next day & time combination

  9. 9

    How to set system time from Unix timestamp

  10. 10

    how to convert a timestamp_t to a real time?

  11. 11

    How to pull day of month from Column header including row data?

  12. 12

    How can I combine fixed month and day with sql year function?

  13. 13

    Design a query for SSRS report to switch between hour, day and month time period grouping

  14. 14

    how to Store the Calender Remainder on Day with time in android

  15. 15

    how to Store the Calender Remainder on Day with time in android

  16. 16

    Fullcalendar - How to add time of the day in week view

  17. 17

    Automatically get the time taking day light saving hours into account

  18. 18

    Convert julian day to day/month/year

  19. 19

    sql - year day to day/month conversion

  20. 20

    How to get longest streak day and average day in Java / Groovy?

  21. 21

    Adding a month to a date. Setting day to last day of given month

  22. 22

    How to extract only datein ddmmyy format from a timestamp

  23. 23

    Loading timestamp upon page load and comparing it to timestamp upon form submit

  24. 24

    Match whole day in SQLite Timestamp

  25. 25

    Comparing to undefined not working every time

  26. 26

    How to parse through a table to gather tide value at a certain time of day

  27. 27

    Extract year and month from timestamp(6)

  28. 28

    change the timestamp to next coming month and keeping the date as it is

  29. 29

    How to get the boot time of Ubuntu?

뜨겁다태그

보관