
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Format date YYYYMMDD as "integer"
Hi,
I would like to check how can I convert a date field to an integer field?
For example, formatting date "20190131" AS integer "20190131"
The original date format is date-time, and I have formatted it with "Date" function to extract the date in format "YYYYMMDD".
Load
Date(EffectiveDate, 'YYYYMMDD') as Date_Key
Resident TableA;
Updated solution:
=> Convert Date to Text then Integer
Load
Num#(TEXT(Date(EffectiveDate, 'YYYYMMDD'))) as Date_Key
Resident TableA;
Accepted Solutions


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure why you would wan to do this, but probably:
Num(Text(Date(EffectiveDate, 'YYYYMMDD'))) as Date_Key


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am not sure why you would wan to do this, but probably:
Num(Text(Date(EffectiveDate, 'YYYYMMDD'))) as Date_Key

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi, thanks for the reply. I tested your method but it didn't work.
The output returns blank instead.
NUM(TEXT(DATE(EFFECTIVE_DATE,'YYYYMMDD'))) AS DATE_KEY

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Jonty,
I retested your method with num#() and it works! Thanks so much 🙂


- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You are absolutely correct - my bad.😀

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I thought Num# was for interpreting and Num was for changing a format. So why does Num# work in this case and Num does not?
