We have configured the Windchill UI settings to display dates & times in the format we want, as per CS74270, eg.: 23-Apr-2013 15:31:20 BST
This correctly switches between GMT and BST when the clocks change in spring and autumn, and displays date and time information consistently across the Windchill UI. We also need to generate and store timestamps in two CAD file Attributes (these Attributes are of type String rather than of type Date, so they are not controlled by the setting above). One of these string Attributes is updated by the download delegate when the file is edited and saved to a workspace, and the other by is updated by a workflow expression when the file is approved.
We are trying to use the following java code to get the timestamps in the format that we want it, so they match the example noted above. The code is :
java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("dd-MMM-yyyy HH:mm:ss zzz");
java.util.Date now = new java.util.Date();
when used in customisations it gives the wrong result: 23-Apr-2013 14:31:20 GMT
but when run in the OS it gives the correct result: 23-Apr-2013 15:31:20 BST There is 1 hour difference in the figures which corresponds with the offset between GMT and BST, so they are both correct representations of the same date & time, but it is confusing for the users. Hence the questions I am asking are : (a) what environment is used to run the java code in the download delegate and the workflow expression, if it not the same environment as a Windchill shell on the same server ? (b) how can we get the java code that runs in the download delegate and the workflow expressions (both of which we understand run on the server) to give the same result as running it in a Windchill shell ?
Can anyone help with this ?