Monday, July 4, 2011

Recover a date yyyymmdd from a timestamp in SQL

This is the problem: I have a field in time-stamp format in my database. I would like to use a SQL statement to retrieve this date in format yyyymmdd. This is the select I have used:

Select
   replace(char(date(your_field), ISO), '-', '')
from
   your_table

No comments: