Hello,
If i had a table with a column type DATETIME
and i had any entry 2003 06 06 06:30:15 does can mysql determine if its an am or pm?
What is needed to implement wheather is a day or night datetime entry?
Kendall
Date Time Column Type in Mysql (AM or PM syntax?)
Moderator: General Moderators
MySQL Date Functions
http://www.mysql.com/doc/en/Date_and_ti ... tions.html
AM
PM
http://www.mysql.com/doc/en/Date_and_ti ... tions.html
AM
Code: Select all
... WHERE HOUR(DateTimeColumn) < 12Code: Select all
... WHERE HOUR(DateTimeColumn) >= 12Or Just:
ampm will now either be AM or PM.
Code: Select all
SELECT DateTimeColumn, DATE_FORMAT(DateTimeColumn, '%p') as ampm FROM table;- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
Date Time Column Type in Mysql (AM or PM syntax?)
Ok,
Well why i asked this is that i did a test post in the PM and when viewing the message the time was stamped with an AM. Now my DATETIME column is set to its default. and i retrieve the date which is formatted in mysql command
[syntax=php]SELECT *,DATE_FORMAT(Date, '%D %a %M %Y %r') AS TheDate[/syntax]
Now assuming that the deafault is 24 hour how does it affect my date translation bewteen php and mysql of input and ouput ?
Kendall
Well why i asked this is that i did a test post in the PM and when viewing the message the time was stamped with an AM. Now my DATETIME column is set to its default. and i retrieve the date which is formatted in mysql command
[syntax=php]SELECT *,DATE_FORMAT(Date, '%D %a %M %Y %r') AS TheDate[/syntax]
Now assuming that the deafault is 24 hour how does it affect my date translation bewteen php and mysql of input and ouput ?
Kendall
- kendall
- Forum Regular
- Posts: 852
- Joined: Tue Jul 30, 2002 10:21 am
- Location: Trinidad, West Indies
- Contact:
Date Time Column Type in Mysql (AM or PM syntax?)
realeasedj,
no... what i mean is that if there was an entry 2003 06 06 6:30:45 how does mysql no if it is 6:30 am or 6:30 pm? Mysql manual said that the default entry for dates is year-month-date hh:mm:ss but they dont affix an am or pm can i manually insert it using php?
Kendall
no... what i mean is that if there was an entry 2003 06 06 6:30:45 how does mysql no if it is 6:30 am or 6:30 pm? Mysql manual said that the default entry for dates is year-month-date hh:mm:ss but they dont affix an am or pm can i manually insert it using php?
Kendall
- twigletmac
- Her Royal Site Adminness
- Posts: 5371
- Joined: Tue Apr 23, 2002 2:21 am
- Location: Essex, UK