Page 1 of 1 1
Topic Options
#142237 - 2005-06-23 11:55 AM Time question + plus ten minutes???
tonyh Offline
Getting the hang of it

Registered: 2002-01-09
Posts: 55
Loc: UK
Hi im trying to create a simple script to get the current time and then create a variable for the current time then plus 10 mins.

eg if the time is current 10:00:00 i want to create a variable which has ten minutes added - 10:10:00

i just cant seem to do it.

thanks it advance

Tony
_________________________
Tonyh

Top
#142238 - 2005-06-23 12:17 PM Re: Time question + plus ten minutes???
Lonkero Administrator Offline
KiX Master Guru
*****

Registered: 2001-06-05
Posts: 22346
Loc: OK
Code:

$CurTimePlusTenMins=iif("23:50"=left(@time,5),"00",right("0"+iif(split(@time,":")[1]="50",1,0)+left(@time,2),2))+":"+iif("50"=split(@time,":")[1],"00",split(@time,":")[1])+":"+split(@time,":")[2]
"CurTime: " @time
"plus the mins: " $CurTimePlusTenMins

_________________________
!

download KiXnet

Top
#142239 - 2005-06-23 01:04 PM Re: Time question + plus ten minutes???
tonyh Offline
Getting the hang of it

Registered: 2002-01-09
Posts: 55
Loc: UK
hi
sorry about this - i have copied and pasted your scripts - the $CurTimePlusTenMins seems to be the same as the current time - am i doing something wrong ?

cheers
_________________________
Tonyh

Top
#142240 - 2005-06-23 02:30 PM Re: Time question + plus ten minutes???
maciep Offline
Korg Regular
*****

Registered: 2002-06-14
Posts: 947
Loc: Pittsburgh
Here's an ugly one i just whipped together

Code:

$time = @time
$mins = split($time,':')[1]
$minsplusten = (10 + split($time,':')[1]) mod 60
$hours = split($time,':')[0]
if $minsplusten < $mins
$hours = (1 + $hours) mod 24
if $hours < 10
$hours = '0' + $hours
endif
$minsplusten = '0' + $minsplusten
endif
$CurTimePlusTenMins= "" + $hours + ':' + $minsplusten + ':' + split($time,':')[2]
"CurTime: " $time ?
"plus the mins: " $CurTimePlusTenMins


Top
#142241 - 2005-06-23 03:08 PM Re: Time question + plus ten minutes???
Les Offline
KiX Master
*****

Registered: 2001-06-11
Posts: 12734
Loc: fortfrances.on.ca
There are also several ready made time UDFs that would do it for you.
_________________________
Give a man a fish and he will be back for more. Slap him with a fish and he will go away forever.

Top
#142242 - 2005-06-23 05:13 PM Re: Time question + plus ten minutes???
Bryce Offline
KiX Supporter
*****

Registered: 2000-02-29
Posts: 3167
Loc: Houston TX
using the UDF's cTime and FlipcTime

Code:

$timeplus10 = ctime(flipctime(@DATE,@TIME)+600)


Top
Page 1 of 1 1


Moderator:  Jochen, Allen, Radimus, Glenn Barnas, ShaneEP, Ruud van Velsen, Arend_, Mart 
Hop to:
Shout Box

Who's Online
0 registered and 1343 anonymous users online.
Newest Members
Viginette, ManuvdWielNL, Sir_Barrington, batdk82, StuTheCoder
17888 Registered Users

Generated in 0.114 seconds in which 0.084 seconds were spent on a total of 12 queries. Zlib compression enabled.

Search the board with:
superb Board Search
or try with google:
Google
Web kixtart.org