Where clause for DateTime Variable
Does someone have an example of a QueryTask where clause when using DateTime variables from DatePicker in a form? I would like to test a date range.
-
Even though this thread is over a year old, did you ever figure this out? This is one of the options I want to implement, also an option to pick a time frame '30 days from current date'.
Right now I'm just trying to have the user pick a date and it be a < > scenario.
1) I have a form that enables the user to pick a short form date MM/DD/YYYY
2) I know I need to change the date picked to a string based on some other threads: CDate(DateTime).ToShortDateString
3) Then I'm trying to put that into a QueryTask where clause: Where "DATEFIELD <= 'CDate(DateTime).ToShortDateString'"
#3 is where it seems to stop in the simulator. Any ideas where I'm going wrong? Can I even have a variable like that in a where clause?
Any infor would be greatly appreciated!
Thanks,
Chase
Variables:
DateTime - Variable Type DateTime
0 -
Got it:
Where Clause: "DATEFIELD <= date '"+objDateTime+"'"
I had to convert my DateTime variable to a string with an Assign first though.
objDateTime = CDate(DateTime).ToShortDateString
......Now to figure out how to do math on a date in a where clause, (DateTime - dateTime.now) = ???....the saga continues...
0 -
Thanks Edmond, I'll definately add that to my arsenal of date workflows. This is actually my first workflow since I took your class!
I'm trying to start off with a simple one but when dates are involved in GIS it's never simple! I'm trying to make a workflow that checks land status lapsing date in relation to todays date ie) Show me what is lapsing in the next 60 days. I've figured out how to get today's date, dateTime.now, and now just need to figure out the mathematic part to put in a where clause. Something like DATEFIELD > dateTime.now AND DATEFIELD < dateTime.now + 60
Chase
0
Du måste logga in om du vill lämna en kommentar.
Kommentarer
3 kommentarer