× Discuss on any other topics

Minus 30 min with current time

  • kda
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 8 months ago #21251 by kda
Minus 30 min with current time was created by kda
HI all

I want to minus 30 min with current time (say : 17:00 then the result will be 16:30)
How can I reach in infobasic?

Thanks

Please Log in or Create an account to join the conversation.

More
6 years 8 months ago #21252 by Mallika
Replied by Mallika on topic Minus 30 min with current time
Hi,

To achieve this using ICONV and OCONV

Y.TIME = TIME() ;* Current time
Y.TIME1 = "00:30:00" ;*30mins
Y.TIME1 = ICONV(Y.TIME1,'MTS')
Y.DIFF.TIME = Y.TIME - Y.TIME1
Y.DIFF.TIME = OCONV(Y.DIFF.TIME,'MTS') ;*difference in HH:MM:SS format

Please Log in or Create an account to join the conversation.

  • VK
  • VK's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Globus|G09-G13 TAFC|R05-R23 TAFJ|R19,R23-test
More
6 years 8 months ago #21253 by VK
Replied by VK on topic Minus 30 min with current time
Hi
will work unless the current time is, say, 00:15 :)))

CHANGETIMESTAMP() is the better way to handle it I believe...

Cheers
VK

Please Log in or Create an account to join the conversation.

  • kda
  • Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
6 years 5 months ago #21386 by kda
Replied by kda on topic Minus 30 min with current time
hi

Can you give sample?

Please Log in or Create an account to join the conversation.

  • VK
  • VK's Avatar
  • Offline
  • Platinum Member
  • Platinum Member
  • Globus|G09-G13 TAFC|R05-R23 TAFJ|R19,R23-test
More
6 years 5 months ago #21387 by VK
Replied by VK on topic Minus 30 min with current time
Hi
here:
* program test.b
    now = TIME()
    CRT OCONV(now, 'MTS')
    start_time = MAKETIMESTAMP(DATE(), now, '')
    
    time_shift = ''
* Structure of time-shifting array:
* Years^Months^Weeks^Days^Hours^Minutes^Seconds^Milliseconds

    time_shift<6> = -30
    end_time = CHANGETIMESTAMP(start_time, time_shift)
    CRT OCONV(LOCALTIME(end_time, ''), 'MTS')
   

Result:
08:45:04
08:15:04

Cheers
VK

Please Log in or Create an account to join the conversation.

Time to create page: 0.115 seconds