Not sure if this is the right place to ask this, but I thought I'd try! When running on the AS400, can anyone tell me where the cal.get function picks up the date/time from? I have a suspicion that it is picking it up wrongly, but I'm not sure...
It isn't picking up the standard AS400 system date/time, nor the job date/time. It is out by an hour, though, so I think it may be to do with BST - how can I see the system defaults for the rules that govern the handling of this? (In case you haven't guessed my java knowledge is pretty much zero!)
Hi, I'm not exactly sure what you wishes to do here. But it seems to me that you're trying to obtain a current system timestamp for logging purposes. Not very sure why you're using BigDecimal here though.
Anyway, here's my codes for getting the current system timestamp in a formatted pattern.
Looking at the source for JDK 1.4, TimeZone uses the system properties "user.timezone", "user.country", and "java.home" in the getDefault() static method. It seems like getDefault() relies on a number of native implementations to do its work so the AS400 just might be doing things a bit differently from the PC when it comes to the default TimeZone and Locale.
Try running the code below to see what kind of values you get and what differences there are between PC and AS400 environments. There might be a simpler, more straightforward way but you could try creating a SimpleTimeZone and passing that to the GregorianCalendar constructor to make sure you have the timezone you need. See the JavaDoc for GregorianCalendar for an example.