//SOLVED
Hello guys,
I'm stuck at comparing after my api change the date from 2019/11/12 to 2191112
I'm getting errors that it can't compare..
How can i solve this.
This is what i had and need:
Dim StartDate As Date = obj.Item("MYDEVICEDATE").ToString 'Start Date
Dim CompareDate As Date = Now.Date 'Todays Date
Dim result as integer = Datetime.Compare(startdate, Comparedate)
So then i tried this just to see if it works :
Sub Main(ByVal Parms As Object)
dim timr2 = "20191112"
Dim StartDate As String = timr2
Dim CompareDate As string = DateTime.Now.ToString("yyyyMMdd") 'Todays Date
Dim result as integer = Datetime.Compare(startdate, Comparedate)
hs.writelog ("look",result)
end sub
Regards
Hello guys,
I'm stuck at comparing after my api change the date from 2019/11/12 to 2191112
I'm getting errors that it can't compare..
How can i solve this.
This is what i had and need:
Dim StartDate As Date = obj.Item("MYDEVICEDATE").ToString 'Start Date
Dim CompareDate As Date = Now.Date 'Todays Date
Dim result as integer = Datetime.Compare(startdate, Comparedate)
JSON | Exception: Conversion from string "20191112" to type 'Date' is not valid. |
So then i tried this just to see if it works :
Sub Main(ByVal Parms As Object)
dim timr2 = "20191112"
Dim StartDate As String = timr2
Dim CompareDate As string = DateTime.Now.ToString("yyyyMMdd") 'Todays Date
Dim result as integer = Datetime.Compare(startdate, Comparedate)
hs.writelog ("look",result)
end sub
Error 1 | Running script C:\Program Files (x86)\HomeSeer HS3\scripts\10101010.vb :Exception has been thrown by the target of an invocation.Conversion from string "20191112" to type 'Date' is not valid. |
Regards
Comment