How to change format of date in Sybase SQL?

Hellow, I have column "MyDate" in table "MyTable" in Sybase SQL. Column "MyDate" has type data and format of data is for example Jan 3, 1902. My question is how can I change format of present date from Jan 3, 1902 to for example 1902/01/03? Could you write my whole code which can do it, not briefly answer please :) Thank you.

1

1 Answer

You can use

DATEFORMAT ( datetime-expression, string-expression )

UPDATE MyTable
SET MyDate= DATEFORMAT(MyDate,'NEW_DATE_FORMAT');

How to Change Date Format in Sybase

Or you can use

CONVERT ( data-type, expression [ , format-style ] )

select CONVERT( CHAR( 20 ), MyDate, 104 ) from MyTable

CONVERT In Sybase

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

You Might Also Like