×
Discuss on any other topics
Minus 30 min with current time
- kda
- Topic Author
- Offline
- Platinum Member
Less
More
- Posts: 603
- Thank you received: 3
7 years 6 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
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.
- Mallika
- Offline
- Junior Member
Less
More
- Posts: 23
- Thank you received: 2
7 years 6 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
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
- Offline
- Platinum Member
- Globus:G9-G13|TAFC:R05-R23|TAFJ:R19,R23,R24:test
Less
More
- Posts: 1191
- Thank you received: 157
7 years 6 months ago #21253
by VK
Cheers
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...
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
Less
More
- Posts: 603
- Thank you received: 3
7 years 3 months ago #21386
by kda
Replied by kda on topic Minus 30 min with current time
hi
Can you give sample?
Can you give sample?
Please Log in or Create an account to join the conversation.
- VK
- Offline
- Platinum Member
- Globus:G9-G13|TAFC:R05-R23|TAFJ:R19,R23,R24:test
Less
More
- Posts: 1191
- Thank you received: 157
7 years 3 months ago #21387
by VK
Cheers
VK
Replied by VK on topic Minus 30 min with current time
Hi
here:
Result:
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.074 seconds