Welcome Serena Central users! CLICK HERE
The migration of the Serena Central community is currently underway. Be sure to read THIS MESSAGE to get your new login set up to access your account.
besafe Contributor.
Contributor.
121 views

making rumba understand whether a date is older than the current date of the day

Jump to solution

Hello Community,

i am working on a script which should look a 2 sets of dates and then it should know what to do. Right now i have made a script which makes it possible for it to understand whether it is less than 30 days ahead, more than 30 days ahead, but i cant seem to figure out how to make it understand when the date is older than the current date

 

my current script looks like this:

'***************************************************************************************************************************
emreadscreen exampleDate3,5,1,71
emreadscreen exampleDate4,5,17,30
emreadscreen status48,5,17,30

ThisYear = Year(Now)
betwDates = DateDiff("d", exampleDate4, exampleDate3)


if betwDates > 30 then
emsetcursor 7,51
emsendkey "-"
emsetcursor 7,52
emsendkey ThisYear

else

emsetcursor 7,51

emsendkey "-"

emsetcursor 7,52

emsendkey Thisyear +1 

 

'****************************************************************************************************************************

 

 

the problem for me is that no matter how i make rumba calculate the difference between the two dates it always comes back as a positive number and it doesn't understand that e.g. 01-04 is older than 01-08

 

@TomFitz  you have helped me before, hopefully you could help me again.

0 Likes
1 Solution

Accepted Solutions
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: making rumba understand whether a date is older than the current date of the day

Jump to solution

Hi,
may the CDate Function is of help.
CDate converts any valid expression to a Date variable.

example:

Sub Main
 Dim MyDate1, MyDate2
 MyDate1 = "01.04.1975"   ' define date with - format
 MyDate2 = "01-08-75"       'define date with . format


 If CDate(MyDate1) < CDate(MyDate2) then
   MsgBox ("older")
 Else
   MsgBox ("younger")
 End If

End Sub

 

View solution in original post

1 Reply
Highlighted
Micro Focus Expert
Micro Focus Expert

Re: making rumba understand whether a date is older than the current date of the day

Jump to solution

Hi,
may the CDate Function is of help.
CDate converts any valid expression to a Date variable.

example:

Sub Main
 Dim MyDate1, MyDate2
 MyDate1 = "01.04.1975"   ' define date with - format
 MyDate2 = "01-08-75"       'define date with . format


 If CDate(MyDate1) < CDate(MyDate2) then
   MsgBox ("older")
 Else
   MsgBox ("younger")
 End If

End Sub

 

View solution in original post

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.