Can someone tell me what I am doing wrong when using DateTime.Date(). I should be logging four different dates but instead each of the calculated dates are the same. I have tried everything I can think of and still having the problem. Even after removing it from the app being written. It has to be something that I am overlooking.
Here is what it is logging. Should be
1485237900000 - 2017/05/24
1477285500000 - 2016/05/24 2017/02/24
1469336700000 - 2016/05/24 2016/11/24
1453615500000 - 2016/05/24 2016/05/24
looks like they are all logging the last one
<code>
Sub AppStart (Form1 As Form, Args() As String)
Dim LatestDate, Date3Mo, Date6Mo, Date12Mo As Long
DateTime.DateFormat = "yyyy/mm/dd"
LatestDate=DateTime.DateParse("2017/05/24")
Log(LatestDate & " - " & DateTime.Date(LatestDate))
Date3Mo = DateTime.Add(LatestDate,0,-3,0)
Log(Date3Mo & " - " & DateTime.Date(Date3Mo))
Date6Mo = DateTime.Add(LatestDate,0,-6,0)
Log(Date6Mo & " - " & DateTime.Date(Date6Mo))
Date12Mo = DateTime.Add(LatestDate,-1,0,0)
Log( Date12Mo & " - " & DateTime.Date(Date12Mo))
End Sub
</code>
Here is what it is logging. Should be
1485237900000 - 2017/05/24
1477285500000 - 2016/05/24 2017/02/24
1469336700000 - 2016/05/24 2016/11/24
1453615500000 - 2016/05/24 2016/05/24
looks like they are all logging the last one
<code>
Sub AppStart (Form1 As Form, Args() As String)
Dim LatestDate, Date3Mo, Date6Mo, Date12Mo As Long
DateTime.DateFormat = "yyyy/mm/dd"
LatestDate=DateTime.DateParse("2017/05/24")
Log(LatestDate & " - " & DateTime.Date(LatestDate))
Date3Mo = DateTime.Add(LatestDate,0,-3,0)
Log(Date3Mo & " - " & DateTime.Date(Date3Mo))
Date6Mo = DateTime.Add(LatestDate,0,-6,0)
Log(Date6Mo & " - " & DateTime.Date(Date6Mo))
Date12Mo = DateTime.Add(LatestDate,-1,0,0)
Log( Date12Mo & " - " & DateTime.Date(Date12Mo))
End Sub
</code>