I am sure there was probably an easier way to do this but I could not readily find one.
So I built this app for the web and long-story-short, the client now also needs to be used. I already had a date field set up on the web and had implemented a picker on the web. I then had background agents running and the date format had to be mm/dd/yyyy. Since this picker would not work from the client. I created a new date field in a layout region and hid it from the web. Then in the querysave event, I set the original field (used on web) to the value of my new field.
The problem was that even though January 1, for example, displayed as 01/01/2206, the actual value of the field when I got a handle on it was 1/1/2006. I did some searching and could not find a way to fix this so I finally put a little code together and am sharing it here for someone else.
clientsdate = doc.clientsdate
pos = Instr(clientsdate(0), "/")
mc = Left(clientsdate(0), pos -1)
If mc Like "#" Then
mc = "0" & mc
End If
dc = Mid(clientsdate(0), pos+1, 2)
If Right(dc, 1) = "/" Then
dc = "0" & Left(dc, 1)
End If
yyyy = Right(clientsdate(0), 4)
clientsdate = mc & "/" & dc & "/" & yyyy
Now. If one of you guru’s knows a better or easier way I could have done this with some option, please let me know.