Simple Date Formatting for use in methods

I was looking for a simple way to get a date object into MM/dd/yyyy format and it took forever before i realized that Servoy is using it’s own instantiations of common java objects/methods

here is how I finally got it to work:

myform.find()
var simpledate = java.text.SimpleDateFormat(“MM/dd/yyyy”)
date_ordered = simpledate.format(globals.s_date_ordered)
date_recieved = simpledate.format(globals.s_date_recieved)
myform.search(true, false)

The simpledate object (type SimpleDateFormat) can be used over and over again, it holds the desired formatting. You simply need to instantiate it once.

And, you can do:

myform.find() 

date_ordered = "#" + utils.dateFormat(globals.s_date_ordered, "MM/dd/yyyy") + "|" + "MM/dd/yyyy";
date_recieved = "#" + utils.dateFormat(globals.s_date_recieved, "MM/dd/yyyy") + "|" + "MM/dd/yyyy";

myform.search(true, false)

Where you would use the “#” to select all rows at that date disregarding the time component.