|
-
Sep 22nd, 2016, 02:21 PM
#1
Thread Starter
Member
[RESOLVED] Date Time today if then issues
I am trying to compare a web form field with a date, and for some reason the compare never works. Here's the code:
Code:
Dim latepay As Decimal
Dim Payment As Decimal = (total * 0.25)
If Payment * 0.1 < "10" Then
latepay = "10"
Else : latepay = (Payment * 0.1)
End If
If total = "0" Then
Payment = "2.00"
End If
If DDLQtr.SelectedValue = "1" And DateTime.Today.ToString("M") > "4" Then
Payment = Payment + latepay
ElseIf DDLQtr.SelectedValue = "1" And DateTime.Today.ToString("M") <= "4" Then
Payment = Payment
End If
If DDLQtr.SelectedValue = "2" And DateTime.Today.ToString("M") > "7" Then
Payment = Payment + latepay
ElseIf DDLQtr.SelectedValue = "2" And DateTime.Today.ToString("M") <= "7" Then
Payment = Payment
End If
If DDLQtr.SelectedValue = "3" And DateTime.Today.ToString("M") > "10" Then
Payment = Payment + latepay
ElseIf DDLQtr.SelectedValue = "3" And DateTime.Today.ToString("M") <= "10" Then
Payment = Payment
End If
If DDLQtr.SelectedValue = "4" And DateTime.Today.ToString("M") > "1" Then
Payment = Payment + latepay
ElseIf DDLQtr.SelectedValue = "4" And DateTime.Today.ToString("M") <= "1" Then
Payment = Payment
End If
The problem is, that regardless of the DDLQtr value chosen, the latepay is always applied. For example, if I choose DDLQtr value '3', and the DateTime.Today.ToString is '09/22/2016', should it not choose the elseif line to process? I have tried this with the "M", "MMM", and "MMMM" parsing, and nothing seems to work.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|