datetime - How to get AM/PM by ADDTIME() in MySQL -


i have 1 field starttime in database , value '7:00:00 pm', want add 20 minutes in time , store in new field endtime. want endtime in same format starttime '07:20:00 pm', used addtime, , many more function this, unable format of am/pm, used

date_add('next_contact_time', interval 20 minute), date_format(addtime(next_contact_time,'00:20:00'),'%h:%i:%s %p') endtime 

but, i'm not able am/pm

use this

declare @starttime time(0) = '07:00:00 am'; --time declare @minutestoadd int = 20; --added 20 minutes select substring((convert(varchar(8), dateadd(minute, @minutestoadd, @starttime), 109)),0,8) + ' ' + right(convert(varchar(30), dateadd(minute, @minutestoadd, @starttime), 9), 2) time 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -