Hi Folks - sorry I pulled my last post in order to re-state my challenge more clearly (and cause I fixed part of it).
I have a form variable, shown in a combobox, the variable is formatted correctly with:-
var startDate = utils.dateFormat(new Date(),‘dd-MM-yyyy’);
which gives me a default of today (thats OK for my needs). However the combo drop down shows the VList dates in the yyy-MM-dd format still?
EDIT:
I’ve checked the type in the Db for the DP of the VList and its a DATE, and in Servoy the DP is set to dd-MM-yyyy in Default Format.
MY DATE FORMAT IN THE Db IS yyyy-MM-dd - Apparently I cant change that in MySQL so I need to change the display type for the VList.
Q. Is there something else I can do to get this format correct in the VList?
Q. If I do date arithmetic on dates in differing formats dd-MM-yyyy / yyyy-MM-dd will the results be correct? (Mainly I’m looking to search on rows that have dates between startDate and endDate).
Without testing I can’t figure out why there is a format discrepancy. From your description I would assume it to work.
An idea to try: since date range searches is all done with strings that you concat together to produce a properly formated date range search value, maybe the manual value list approach would set you straight (return dates in a dataset, loop through and format each value, assign to the value list).
david:
Without testing I can’t figure out why there is a format discrepancy. From your description I would assume it to work.
Date formatting is always a bugger.
Thanks for your feedback David - this is hugely overly complicated for what should be a simple task!
It seems like this:
If I take a data provider from my table I can format that correctly (lulled me into a false sense of security - obviously ).
If I use a form variable as a data provider I can’t format that without adding a default date to it (I think?) and the value-list attached is wrongly formatted - adding a format to it (form element) actually puts the text ‘dd/MM/yyyyy’ in the field on the form as if it was an entry - all very confusing. Its seems its only a challenge if I’m using a form/global variable as a data provider.
In addition, it seems in fact, that any time I use a date column in a valuelist it’s then not possible to format it to dd/MM/yyyyy?
jcompagner:
first is the form variable really a date? (is it’s type a date ?)
Johan I have the variable formatted like this
var startDate = utils.dateFormat(new Date(),‘dd/MM/yyyy’);
I assume thats correct? It actually puts todays date in te variable (in the right format) and thats acceptable. The valuelist is also correct when viewed in the drop down but the selected value is inserted into the form fields as yyyy/MM/dd.
I’ll see if I can work-up a single form and tables to make a test case.