Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

performing math functions with $DATE 1

Status
Not open for further replies.

teletubby5e

Technical User
Oct 31, 2002
147
US
i am trying to find out if procomm converts to a julian date, so that i can perform some math functions to test befor proceeding with the rest of the script. I am trying to do a date check to run a subroutine. something like this .....

if date >= 1/16/2004
run subroutine
endif

and so far i have tried to modify the following from the help file.

DateGet = $DATE ;sets the name from Control Panel
usermsg "%s" DateGet ; displays it in 1/16/2004 format
BinaryNum = "%s" DateGet
strtonum BinaryNum Number 2 ; Convert number to base 10.
usermsg "And the number is...%d!" Number

can someone steer me to the right command? this would be a useful tool to start putting in my scripts. "if past a certain date halt, else run the rest of the script." any help will be greatly appreciated.
thanks, jeff
 
I think you'll find it easier to do this if you use some of the date and time related commands to break up the value of $LTIME into component integer values representing month, day, etc. In this case, ltimeints would be the command to use.


aspect@aspectscripting.com
 
Many thanks!!!
That ius exactly what I was looking for. I can get it narrowed down to the level of time granularity that i need later but this will let me program in an expiration date on some aspect scripts, and also will let me make some scripts that cannot be accidentally run outside our 'maintenance window.'

proc main

integer Month, Day ; Integers to contain date and
integer Year, Hour ; time converted from long
integer Min, Sec ; date and time.
string MonStr ; String to contain month.

; Convert long time value into it's counter parts, year,
; month, day, hour, min, and sec.
ltimeints $LTIME Year Month Day Hour Min Sec
monthstr Month MonStr ; Get the month in string format.

if Year > 2004
halt
endif
if Year < 2004
halt
endif

if Year = 2004
; run subroutine in here
usermsg &quot;Year is %d Month is %s and it's day %d.&quot; Year MonStr Day

endif

endproc
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top