8 Replies Latest reply: May 15, 2014 10:01 AM by Nick Osdale-Popa RSS

    Time Format Question

    dssfaxman _

      Hello everyone, I am new to Monarch and to this forum. I have had no luck finding an answer to my question so far. Brace yourselves for this one, I am using Version 4.05 and I need to set the format on my fields for time. I know that on newer versions the setting is Date/Time but there is no setting like this in v4. I need my table to show 16:00 as 4:00 pm. Does anyone know if there is a work around for this or am I out of luck until my company decides to update my software? Hope no one hurts themselves while laughing.

        • Time Format Question
          Nick Osdale-Popa

          Do a search for the number url=http://www.monarchforums.com/search.php86400[/url]. Not sure if any of those results will help, but it may give you a starting point.

            • Time Format Question
              Data Kruncher

              Having never seen v4 in action, I don't know what constraints you have in terms of available functions or even data types, but if you go with a "lowest common denominator" type of approach, the following might work for you.

               

              Assuming that you extract your time (MyTime) as a Character field, build a TimePrefix field:

              [SIZE=2]

              if(val(left(mytime,2))=0,"12"+right(mytime,3),

              if(val(left(mytime,2))>12,trim(str(val(left(mytime,2))-12))+right(mytime,3),mytime))

              /SIZE[/CODE]

               

              and a TimeSuffix:

               

              [SIZE=2]

              if(val(left(mytime,2))<12," am"," pm")

              /SIZE[/CODE]

               

              and a final Time field:

              [SIZE=2]

              TimePrefix+TimeSuffix

              /SIZE[/CODE]

               

              Will that do the trick?

                • Time Format Question
                  dssfaxman _

                  Are these examples of expressions that I would enter using the filters? If this is not correct then where would I enter this code? The filter is the only area that I have seen with function code. As I said I am new to Monarch and I am trying to read the v6 manual to use v4. Thank you.

                    • Time Format Question
                      dssfaxman _

                      Here is an example of what I am trying to do.

                       

                      Equip   Actual  Dispatch Arrive Complete Actual Travel    Job  Pickup /  Comp

                        ID      pickup   time       time    time      close   time    time  dispatch  / close

                       

                      AZ256    08:07    07:45    08:07    09:12    09:23    0:22     1:05    -0:22     -0:11

                      ZA583    10:52    11:38    11:45    12:09    12:10    0:07     0:24     0:45     -0:22

                       

                      I have my template setup to capture the pickup time and the close time and this information is listed in the table correctly, but when I export the table to a csv file my problem occurs. Since the time is in a field that is only formatted for numbers Excel does not handle it as a time of day and then my calculations in Excel do not work. We have v7 in our office and you can go into field properties and set the field for Date/Time and everything works perfect. I am just trying to do it in v4 because I know that I will never see anything better.

                        • Time Format Question
                          Data Kruncher

                          In the Table window, you want to create calculated fields: one for each of the formulas shown above.

                           

                          Hopefully the functions I used in those formulas exist in v4.

                           

                          Of course, I had in mind that you would have one time field per record, not the handful in your sample! Yikes.

                           

                          For the amount of time you might spend on this, you might be better off paying for v9 yourself.

                           

                          Not to worry. I'm sure that we can work this out one way or other with v4 for you.

                            • Time Format Question
                              dssfaxman _

                              Thank you for your suggestions but I just did my reports the old way and at least got my company looking into updating my Monarch. They see that it will cut down on our time dealing with reports allowing me to do other things. Does anyone sell older versions as they move up to newer versions? My time issue is corrected in v7 and I know Monarch is on v9. I would think a lot of v7 disks would be unused since v9 is out and to jump from v4 to v7 would be super for me.

                                • Time Format Question
                                  Bill Tilghman

                                  This is what I did for years. Outside on Monarch of course.

                                   

                                  for /F "tokens=1-4 delims=/ " %%i in ('date /t') do (

                                     set DayOfWeek=%%i

                                     set Month=%%j

                                     set Day=%%k

                                     set Year=%%l

                                     set Date=%%i %%k/%%j/%%l

                                  )

                                  ECHO Date is %Date%

                                  ECHO Day of Week is "%DayOfWeek%", Month is "%Month%"

                                  ECHO Day is "%Day%", Year is "%Year%"

                                  ::

                                  ::

                                  rem -


                                  for /F "tokens=1-3 delims=: " %%m in ('time /t') do (

                                       set hour=%%m

                                       set min=%%n

                                       set Time=%%m:%%n

                                  )

                                  ECHO time is %time%

                                  Echo hour is "%hour%", min is "%min%"

                                    • Time Format Question
                                      Nick Osdale-Popa

                                      Those look a lot like what I use!

                                       

                                      ECHO Date %DATE%

                                      FOR /F "tokens=1-4 delims=/ " %%a IN ("%DATE%") DO (SET wd=%%a) & (SET mth=%%b) & (SET day=%%c) & (SET yr=%%d)

                                      ECHO Weekday=%wd%  /  Month=%mth%  /  Day=%day%  /  Year=%yr%

                                       

                                      ECHO Time %TIME%

                                      FOR /F "tokens=1-4 delims=:. " %%a IN ("%TIME%") DO (SET hr=%%a) & (SET mn=%%b) & (SET sc=%%c) & (SET ms=%%d)

                                      ECHO Hour=%hr%  /  Minutes=%mn%  /  Seconds=%sc%  /  Milliseconds=%ms%

                                      /quote

                                       

                                      With it, I was able to create my own batch-based delay routine without using 3rd party software.