SQL - Date

Database

SQL - Date

All,

My input: YYYYMM(varchar(6))

eg:201512

My requirement is  YYYYMMDD

eg:20151201 & 20151231 (First day of month and last day of month)

Pls help!!!

2 REPLIES

Re: SQL - Date

Hi.

SELECT CAST(CAST(MY_COL AS DATE FORMAT 'YYYYMM') AS FORMAT 'YYYY-MM-DD') FDOM,

ADD_MONTHS(FDOM, 1 ) - 1 LDOM

FROM ( SELECT '201511' MY_COL ) a

;

*** Query completed. One row found. 2 columns returned.

*** Total elapsed time was 1 second.

FDOM LDOM

---------- ----------

2015-11-01 2015-11-30

HTH.

Cheers.

Carlos.

Re: SQL - Date

thanks alot