Does anyone know how can I change the format of dates used in “search” fields... e.g. on the Sales Order Line tab the Order value displayed is in the format OrderNumber_OrderDate and the date format is m/d/y ... how can I change this format to say y/m/d?
Very good question.
I tried to research this but it looks that it will take more time than i have.
please try to research classes around
MLookup and MLookupInfo
MLookup.get: C_Order.C_Order_ID: 1000000; Size=0; Validated=true; All Loaded=false; HasInactive=true 
MLookup.getDirect: C_Order.C_Order_ID: 1000000, SaveInCache=false,Local=true 
MLookup.getDirect: C_Order.C_Order_ID: 50000_08/04/2006 - MLookupInfo[C_Order.C_Order_ID-Direct=SELECT C_Order.C_Order_ID,NULL,C_Order.DocumentNo ||'_'|| TRIM(TO_CHAR(C_Order.DateOrdered,'MM/DD/YYYY')),C_Order.IsActive FROM C_Order WHERE C_Order.C_Order_ID=?] 
wish you luck.
I think that this is hardcoded somewhere, but the problem is to sind this somewhere...
About Date Format i know that it depends on Os format. so you could try to set in your Os required by you format. If it do not work than you need to research Compiere.
Ok, Trifon thanks for th tips!
I thought perhaps it might just my setup. I had a DB created with the US format, so I recreated using Uk format ... but it made no difference.
I've been playing around with different language & translation setups but none of that seemed to make a difference either.
If it's somethying hardcoded I'll investiage further in the code ...
>>About Date Format i know that it depends on Os format. so you could try to set in your Os required by you format. If it do not work than you need to research Compiere.
I have the OS date's format as dd/mm/yyyy but I see the Order value as said Colin. I belive that the way is by research the code as said Trifon.
Well I have an answer.
It is controlled from within the application after all and not in the code!! which is good news.
The languages are mainatain (using the System Administration role) via General Rules->Language. By default the Date Pattern is blank for all languages!?
If you set date format as dd/MM/yyyy for the language you login with then the dates should display in the correct format.
In the code it goes deep, but ultimately comes down to the DB & the Language you use.
In org.compiere.db.DB_Oracle (that's in the dbport folder) the TO_CHAR method has the following
else if (DisplayType.isDate(displayType))
Which i the code resposnsible for the date conversion we see in the trace (i.e. called from MLookup & MLoookupInfo).
I noticed that the variant of English I'm using en_IE (Ireland) was not defined in the Language class so I added it, but it seems to work without this modification, just so long as I set the correct date format in the General Rules->Language window... but I'll leave that puzzle for another day? perhaps it's a hangover from an earlier version?
anyway thanks for the hints & tips
a slight mistale there the languages are maintained in General Rules->System Rules->Languages
well I restored my DB and then set the Date Pattern again as I mentioned above and it did not have the desired effect this time!?
So I must have done something else too... More when I have figured out what I did!
After setting the new "Date Pattern" in the Language window you must run the select "Language Maintenance" button. When prompted for maintenance mode I selected re-create. Be aware this takes a LONG time to run but when it was complete the date format of these "search" type fields was dd/mm/yyyy (changed from mm/dd/yyyy!).
I'm still not sure why that is necessary!? ... the code seems to indicate these (search) fields are created using the org.compiere.db.Oracle_DB.TO_CHAR() and the date format is taken from the Language - as I indicated in an earlier post.
Log in to post a comment.
Sign up for the SourceForge newsletter:
You seem to have CSS turned off.
Please don't fill out this field.