How to set date format in sybase?

2019-08-21 13:34发布

问题:

How to set date format in sybase?

Currently it's inserting default date format Jan 9 2014 1:07AM to Sybase DB,But i have to insert seconds also like "20140109 01:06:46"

Is there any way i can set date format in stored proc.

please suggest me,thanks!

回答1:

select --cast(
        dateformat('Jan 9 2014 1:07AM','YYYYMMDD HH:NN:SS') --returns varchar
        --as datetime) --datetime object in database datetime format