Date Formatting Troubleshooting Tips
SUMMARY: There are sometimes problems using a special date formatting in date columns, especially when using an european date format. This techdoc explains the workarounds that can be used to achieve correct results. Document ID: 1002124 Last Revised: 01/12/2000 Topic: App Development Document Type: TechNote Product: PowerBuilder Version: 7.0 Platform: PC Operating System: Windows 95, Windows NTDocument:
There are sometimes problems using a special date formatting in datecolumns, especially when using an european date format. Thistechdoc explains the workarounds that can be used to achievecorrect results for the following CR's that are known in SybaseTechnical Support.
1.CR 210277 When setting a display format with a european dateformat eg. German dd.mm.yyyy in a HTML datawindow the wrongdatesequence in the HTML gets generated. This causes problemswhen trying to update the date, when the user tries to put in the date inthe local format.
2.CR 207244/147261 DDDW Display of date format changes to aformat of yyyy-mm-dd when getting focus.
1)Description of the problem:
Normally the date sequence which is generated by the Jaguarcomponent should be determined by the language settings in thecontrol panel. According to the HTML preview this is what getsgenerated:
// this is dependent on the control panel setting on the
server
// it indicates the order of days (this is mm/dd/yyyy)
var DW_PARSEDT_monseq = 0;
var DW_PARSEDT_dayseq = 1;
var DW_PARSEDT_yearseq = 2;
So when the date settings on the server are eg. Dd/mm/yyyy it shouldget reflected in the generated HTML, but due to the incorrect behaviorit does not pick up the changes in the language settings.
Workaround:
To overcome this problem the date sequence needs to be adjusted tothe language settings. In order to implement this for the previousexample (dd/mm/yyyy) the generated HTML needs to be modified
before being passed back to the client.
This can be done by modifying the HTMLGenerator component ie. byextending the code in the generate() method ofnv_remote_datawindow allows the correct HTML to be passed backto the client browser.
The method looks as follows:
string ls_result
if ib_trace then of_log_enter("Generate()")
ls_result = ids_datastore.Describe("DataWindow.Data.HTML")
//
// This is the date order without modification
//
//var DW_PARSEDT_monseq = 0;
//var DW_PARSEDT_dayseq = 1;
//var DW_PARSEDT_yearseq = 2;
//
// This should be the date order for German date sequence
dd.mm.yyyy
//
//var DW_PARSEDT_monseq = 1;
//var DW_PARSEDT_dayseq = 0;
//var DW_PARSEDT_yearseq = 2;
string DW_PARSEDT_monseq ="DW_PARSEDT_monseq = 0"
//Month-String to be found
string DW_PARSEDT_dayseq ="DW_PARSEDT_dayseq = 1"
//Day-string to be found
string DW_PARSEDT_monseq_new ="DW_PARSEDT_monseq =
1" //Replacement for default month
string DW_PARSEDT_dayseq_new ="DW_PARSEDT_dayseq = 0"
//Replacement for default day settings
long position
position = pos(ls_result, DW_PARSEDT_monseq ) //Gets the variable
position in the html code
ls_result = Replace ( ls_result, position, 21,
DW_PARSEDT_monseq_new )
position = pos(ls_result, DW_PARSEDT_dayseq ) //Gets the variable
position in the html code
ls_result = Replace ( ls_result, position, 21,
DW_PARSEDT_dayseq_new )
if ib_trace then of_log_exit("Generate(), length = " +
String(Len(ls_result)))
of_completeWork()
return ls_result
2)Description of the problem:
Assume you have a normal tabular datawindow containing a datecolumn. This date column should be of type dropdowndatawindow toallow users to select special predefined dates having the formating ofdd/mm/yyyy.
The base column (here column start_date) should also have thedd/mm/yyyy format. The nature of the problem is, that when the columnge

