Wednesday, September 21, 2011

sql: parse time string

to get time parts from time string
select
lpad(left(mytime,locate(':',mytime)-1),2,'0') as hour,
lpad(substring(mytime,locate(':',mytime)+1,locate(':',mytime,locate(':',mytime)+1)-locate(':',mytime)-1),2,'0') as min,
lpad(right(mytime,length(mytime)-locate(':',mytime,locate(':',mytime)+1)),2,'0') as sec
from mytable;

No comments:

Post a Comment

SSH : No matching host key type found. Their offer: ssh-rsa,ssh-dss

Got this while connecting to my mikrotik router via ssh   Unable to negotiate with <ip address> port <ssh port>: no matching hos...