Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sybase: How to get the current date in mm/dd/yyyy format?

I want to insert the mm/dd/yyyy format into a table and after that compare it with the current date when fetching results from the table to display.

The getdate() function returns the complete timestamp and am unable to extract the date in my desired format.

like image 327
swateek Avatar asked Sep 28 '13 18:09

swateek


1 Answers

You are looking for this SQL to make the conversion:

select convert(varchar, date_column, 101) from the_table

The important part in part in this case is 101 which is specification of mm/dd/yyyy format as per documentation. If you have Sybase ASE 15.7 use this, if you have SAP ASE 16.0 (released 2014) use this (has more options).

like image 101
Rahul Tripathi Avatar answered Sep 21 '22 11:09

Rahul Tripathi