14 Replies Latest reply: Nov 11, 2011 10:32 AM by Juan Escobar RSS

    Clock

    Juan Escobar

      Hello,

       

      I'm trying to insert the date into my project. But I was wondering how can I add the system information (mm/dd/yyyy) or the IP information.

       

      Thank you very much.

        • Clock
          Stefan Wühl

          Hi Juan,

           

          you could use today() function in an object, e.g. text box to display today's date.

           

          With IP, you mean the network IP address, right?

           

          I don't think that there is a system function for that, but search the help for all "system functions".

          There is a ComputerName() function and you could query Registry entries or call system functions or use macros to retrieve more information from your system.

           

          Hope that helps,

          Stefan

          • Clock
            Erich Shiino

            hi, Juan

            Do you want to include it in the interface? I'm sure about the IP

            But you could insert a text box with the following Expressions

            =Date( today(), 'MM/DD/YYYY') => to get the system date

            =now() => to create a clock (this can be a performance problem since the interface will be refreshed every second)

            =osuser() => to get the user login (operational system login)

            =qvuser() => to get the name of the user in the case of a section access using name/password

             

            Hope this helps,

             

            Erich

              • Re: Clock
                Juan Escobar

                Ok, that worked fine. Now I want to add some text (strings) and in the middle of that insert the =Date(today(),'MM/DD/YYYY').

                 

                How can I do that? i.e: inside the text box: Today's date is: =Date(today(),'MM/DD/YYYY')

                 

                And also how can I modify the date format???

                 

                El mensaje fue editado por: Juan Escobar

                  • Re: Clock
                    Stefan Wühl

                    Try as expression in text box

                     

                    ='Todays date is: ' & Date(today(),'MM/DD/YYYY')

                     

                    edit: and if you want a apostroph after today

                    ='Today'&chr(39)&'s date is: '&date(today(),'MM/DD/YYY')

                     

                     

                    • Re: Clock
                      Juan Escobar

                      That was awesome! now I want to separate the date from the clock? is it any way? like to say

                       

                      ='Today's date is: ' & Date(today(),'MM/DD/YYYY') and is it [the clock]

                        • Re: Clock
                          Stefan Wühl

                          You could use something like:

                           

                          ='Today'&chr(39)&'s date is: '&date(today(),'MM/DD/YYY')&' and it is '&time(now())

                           

                          Please note that now() will refresh the clock permanently, decreasing system performance, consider using now(0) or now(2) instead.

                           

                          Stefan

                            • Re: Clock
                              Juan Escobar

                              Great! and if I want to change the time format from 24h to am/pm?

                                • Clock
                                  Stefan Wühl

                                  You could also specify a time format with time() similar to the date format with date(). Please look into format codes in the help file.

                                  am/pm time format is specified with tt for example, like in

                                  ='Today'&chr(39)&'s date is: '&date(today(),'MM/DD/YYY')&' and it is '&time(now(),'hh:mm:ss tt')

                                    • Re: Clock
                                      Juan Escobar

                                      Ok, I've done that and works great.

                                       

                                      Now I want to transform an time data that's given as a decimal, how can I transform it from the script into a time format.

                                       

                                      i.e:

                                       

                                      Time from DB          Desired Data

                                      9.00                        9:00

                                      10.35                      10:35

                                      14.10                       2:35 pm

                                       

                                      P.S: when I transform the data I'm losing the 0 at the right.

                                       

                                      Thank you.

                                        • Re: Clock
                                          Stefan Wühl

                                          Try using

                                           

                                           

                                          LOAD

                                          ...

                                          time(time#(TIMEFROMDBFIELD,'hh.mm'),'hh:mm TT') as NEWTIMEFIELD

                                          ...

                                          FROM ...

                                           

                                          time#() will parse the data in as time type, time() will format it (again, check out format codes).

                                           

                                          Hope this helps,

                                          Stefan

                                           

                                          P.S: What do you mean with "when I transform.. " above, could you post your expression?

                                            • Re: Clock
                                              Juan Escobar

                                              What I mean is that when I'm loading the data, its format comes like I wrote (1.42... 14.35... 6.00).

                                               

                                              I've done that that you suggested and it went right. Now all the hours that are o'clock... like 6.00, the script erase the zeros affecting the format transformation.

                                               

                                              Here is the load and an image of the result

                                               

                                              A01:

                                              LOAD

                                                   tradoc,

                                                   trahoi,

                                                   Time(Time#(trahoi,'hh.mm'),'hh:mm TT') as trahoi1

                                              FROM INMTRA_EXT_Copia.qvd (qvd);img.png

                              • Clock
                                Martin Pohl

                                for the date I would suggest now() for the system date and time.

                                For the IP I also don't know if it's possible.

                                Regards