Hi All,
Quick one. I have a webservice which uses numbers in american format which need to be passed as datetime data types when webmethod is called. The issue is the times passed depend on when a button is pressed.
Please ignore variables as this is from testbed project I just use for testing code. Essentially the starttime variable is the time the user clicks the button, starttime is a string. The variable endtime is dependant on the time of day, if between 06:30 and 18:30 endtime is 18:30 that day (the end of the shift), if it is between 18:30 and 06:30 end time is 06:30 (end of night shift).
Essentially I need to get a datetime data type in the format MM/dd/yyyy hh:mm:ss for the corrrect endtime.
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click
starttime = "#" & String.Format("{0:MM/dd/yyyy hh:mm:ss tt}", System.DateTime.Now) & "#"
If TimeOfDay > #6:30:00 AM# Then
If TimeOfDay < #6:30:00 PM# Then
endtime = "#" & String.Format("{0:MM/dd/yyyy}", System.DateTime.Now) & " " & "06:30:00 PM#"
Else
endtime = "#" & String.Format("{0:MM/dd/yyyy}", System.DateTime.Now) & " " & "06:30:00 AM#"
End If
End If
Label1.Text = starttime
Label2.Text = endtime
End Sub
Any ideas?
Cheers
Will