11 Replies Latest reply: Mar 19, 2014 4:29 AM by Francesco Carmellini RSS

    Date & Time

      Hi all


      I am importing date fields from two different tables from a Firebird database.


      Looking at the data types in the Firebird database, they are all just 'Date' rather than 'DateTime'.


      However, the fields that I import from Table B result in the time portion of 00:00:00 being added, even though when I load them in to the final table I use the Floor() function.


      Obviously, I can just format any data tables accordingly but I would rather have uniform data types, especially for dates.


      Can anyone help?





        • Re: Date & Time
          jagan mohan rao appala



          Format the dates using the


          Date(DateField, 'MM/DD/YYYY')





          • Re: Date & Time
            Vishwaranjan Kumar

            try according to this date format.



            • Re: Date & Time

              Thanks for the posts.


              Unfortunately, just using the Date function is not producing consistent results.


              I am using this QlikView script to transform data imported from a Firebird database, so I think I need to understand if there are any implicit conversions happening.


              Here is a typical transfomation statement that I am using for a date (as I don't want any zero length strings in the field)


              If(DATE_SETUP = '', Null(), DATE_SETUP) AS LeadDate

                • Re: Date & Time
                  Miikka Koskinen



                  I sometimes use Left-function to get rid of time:


                  DateTime = 2014/01/01 00:00:00

                  Left(DateTime,10) = 2014/01/01


                  You might need to convert this little more to match another date-type.




                  • Re: Date & Time
                    Celambarasan Adhimulam

                    Please check the field is in date format or simply text?

                    Goto Document properties --> Tables --> Check the Tag for the Field "LeadDate". If tag has $number then probably it is in date format. Then use

                         If(DATE_SETUP = '', Null(), Date(DATE_SETUP)) AS LeadDate

                    No $number tag you need to convert it in to date format by using date# function.

                    To use date# function you need to analyse in which format it is getting loaded to qlikview.

                    MM/DD/YYYY or DD/MM/YYYY or DD-MM-YYYY or MM-DD-YYYY

                    If(DATE_SETUP = '', Null(), Date(Date#(DATE_SETUP, "MM/DD/YYYY"))) AS LeadDate

                    • Re: Date & Time
                      Khadar basha shaik

                      Hi James,

                               can you please share only dates form you data,just two to three rows only.


                         other wise share the data formats you getting.





                    • Re: Date & Time
                      Henric Cronström

                      The time portion is just formatting - added by either the ODBC or by QlikView in the load phase.


                      QlikView does not have any data types (See this article). If it is a number and you have used the floor function, you are all set. You should/could use a Date() function on top of it to get the formatting right, but this is almost just "cosmetics". All numeric evaluations and sorting are based on the number you created with the Floor() function.


                      So, if you want to debug, and see what goes on, format it as a number instead: Num(DATE_SETUP).


                      And the NULL test is better made with

                           If(Len(Trim(DATE_SETUP))>0, DATE_SETUP) AS LeadDate, or   

                           If(IsNum(Date#(DATE_SETUP)), Date#(DATE_SETUP)) AS LeadDate


                      This way you also catch values that contain spaces.



                      • Re: Date & Time
                        Francesco Carmellini

                        goodmorning. replying just not to open a new thread... i'm importing from a database where date and time are 2 different columns (i.e. for each day/date i have as many rows as records are acquired through the timeline); i'd like to concatenate i have to do calculations over another DB where the field "time" has all the parameters (DD/MM/YYYY hh:mm). how can i do that, i.e. not only concatenate characters but obtain a sort of numeric field to use with calculations? thanx