Options

time problem

TikusJalangTikusJalang Member Posts: 12
hi everyone I'm newbie here,

I wanna ask the problem about the field time
I have table named shift, and field named Begin Time and End Time, and both of it has data type time...
at the regional option in control panel, I fill the format for time is "HH:mm:ss"

but when I fill the table with Begin Time "22:00:00" and End Time "3:00:00" and doing some code to check the record I found the bug I think...
I create new variable data type time, I named it "varTime" and I fill this variable with "1:00:00"
when I doing some coding like this :

IF (varTime > rec."Begin Time") AND (varTime < rec."End Time") THEN
Message('Success!');

but the message never pop-up and if I think the logic is right because when I fill the table with time less than "00:00:00" it worked !!!!!!
but if I fill with time more than "23:59:00" it didn't work...

can you fix this problem pls?

Thnks b4... :wink:

Comments

  • Options
    g_dreyerg_dreyer Member Posts: 123
    You probably will need to do something like:

    IF (varTime > rec."Begin Time") AND (varTime < "23:59:59") OR
    (varTime > "00:00:00") AND (varTime < rec."End Time") THEN
    Message('Success!');

    Not sure if you can use "24:00:00" vs. "23:59:59".

    Alternative you could use CREATEDATETIME(Date, Time) to calculate your begin time and end time on the fly, and should you use CURRENTDATETIME, you would be able to use your
    IF (varTime > rec."Begin Time") AND (varTime < rec."End Time")
    since now it would fall between the two dates and time.

    Regards,
    gus
  • Options
    TikusJalangTikusJalang Member Posts: 12
    g_dreyer wrote:
    You probably will need to do something like:

    IF (varTime > rec."Begin Time") AND (varTime < "23:59:59") OR
    (varTime > "00:00:00") AND (varTime < rec."End Time") THEN
    Message('Success!');

    Not sure if you can use "24:00:00" vs. "23:59:59".

    Regards,
    gus



    wooowww, it success!!!! I never think about this way... #-o
    Thank you very much gus...
Sign In or Register to comment.