On 5/30/17, rajesh mekala <rajesh.mek...@goldcrm.com> wrote:
>
> Hi all,
>
>
>      This is Rajesh. I am using SQLITE db. Actually in my database i have
> one column.i want to convert my column value am/pm to 24hrs formate.
>
>
> Ex:
>
> Step 1:  I have one column.
>            Column name: Ts
>  Column Have this value :2016-09-19 08:56:00 PM.
>
> My Query: strftime('%m/%d/%Y',trim(Ts,'AM/PM') ) as T.
>
> when i am running this query i get this output
>
> Output: 08:56:00.
>
> Step 2:
>
> i don't want output like  08:56:00.because end user don't know whether
> 08:56:00 Am or Pm.
>

Perhaps convert your data to 24-hour format like this:

UPDATE yourtable
      SET Ts = CASE WHEN Ts LIKE '%PM'
                          THEN datetime(trim(Ts,'PM '), '+12 hours')
                          ELSE datetime(trim(Ts,'AM ') END;

-- 
D. Richard Hipp
d...@sqlite.org
_______________________________________________
sqlite-users mailing list
sqlite-users@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to