Skip to main content
Announcements
Join us at Qlik Connect for 3 magical days of learning, networking,and inspiration! REGISTER TODAY and save!
cancel
Showing results for 
Search instead for 
Did you mean: 
gireesh1216
Creator II
Creator II

Date Format Changes

How to change number format to date format?

Example Number:-693593



I am using DATE(-693593  ) function.getting 01-01-0001.

how to convert  -693593  to  01-01-2001 ????

1 Solution

Accepted Solutions
tresesco
MVP
MVP

Then you may try a static fix like:

Date(If( [Termination Date]<0, MakeDate(2001,1,1), [Termination Date])) as [Termination Date]

View solution in original post

20 Replies
Miguel_Angel_Baeyens

Hi Gireesh,

Indeed, dates cannot be negative numbers in QlikView[1]. First you will need to Fabs(Field) to remove the negative number without affecting the value and then use the Date() function.


Miguel

[1] For the sake of being as technically accurate as possible, dates can be whatever number with whatever sign, integer or with decimals, positive or negative. Noting that Day 1 for the Date() function in QlikView is 31/12/1899 (DD/MM/YYYY), any day with negative sign means it happens before that day. If that is the date coming from the source, it is likely that the field in the source is empty or the day 1 for that source system, which could be whatever value.

gireesh1216
Creator II
Creator II
Author

Thanks Miguel...

But How to remove negative numbers in QlikView? please help me on this...

Miguel_Angel_Baeyens

I already told you, use the Fabs() function on the date in the script:


Date(Fabs(DateField)) AS Date

Miguel

gireesh1216
Creator II
Creator II
Author

Hi Miguel....

I am using Date(fabs(-693593)) as Date_join.But  iam getting wrong date(12/27/3798)..

Miguel_Angel_Baeyens

Yes, 693593 is that future date for QlikView.

In QlikView, Day 1 is 31/12/1899, and today is day 42644, so I don't know where that date is coming from but that seems definitely wrong.

Anil_Babu_Samineni

Miguel, I think to day is day 42663

And Gireesh, You might have few Forecast Data for future

LOAD *, Date(fabs(Date),'DD-MM-YYYY') as Date1;

LOAD * Inline [

Date

-693593

-693543

-693234

];

Screen Shot which i got is below for Date1

Capture.PNG

Best Anil, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful
gireesh1216
Creator II
Creator II
Author

hi,

use DATE(-693593  ) function u will get 01-01-0001.

I want 0001 to 2001

vcanale
Partner - Creator II
Partner - Creator II

Hi,
from Miguel reply Date(fabs('NegativeNumb')) works correctly, but where "-693593" comes from?

01-01-2001 --> 36892
eg:
Date(Fabs('-36892')) returns 01-01-2001

gireesh1216
Creator II
Creator II
Author

In database showing data for one employee

:db data.PNG

After I loaded in qlikview getting below data:

AFTER LAODING.PNG

USING DATE(FIELD NAME ) GETTING BELOW DATA:

QLIKVIEW USING DATE.PNG

finally i want  date format in 01/01/2001