In MySQL, how you convert time in AM / PM to minute after midnight format.
EG:- 1. 8:40 AM will be 520
2. 9:00 PM will be 1260
Thanks
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
First convert the string to a date with
STR_TO_DATE(), then do the calculation withHOUR()andMINUTE()functions:Results in:
And …
Results in: