on 08-11-2006 9:48 PM
Hi,
I map unix timestamps from MaxDB to the controller context of Web Dynpro and display the results in a table. Is there a smart way to convert the timestamps to human readable date and time? Maybe some way to manipulate the table values with a function before they are written ..?
For now, I create a new node in the context and manually set each value with the according date/time representation ... but thats pretty cumbersome.
Thank you very much for your help!
Cheers,
boris
Hi Boris,
Check http://java.sun.com/j2se/1.3/docs/api/java/text/SimpleDateFormat.html
Date currentTime_1 = new Date(longUnixTimestamp);
String dateString = formatter.format(currentTime_1);
I would suggest you to create a calculated attribute under the same node as initial timestamp value and return a result of SimpleDateFormat.format().
Best regards, Maksim Rashchynski.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Maksim,
thanks for your answer. My problem is not so much the conversion but the way I handle the data in the context: Do I have to convert and set context attributes manually, or is there a way to map the unixtimestamps to a table but convert them before with some onDisplay-function ...?
Cheers,
boris
Hi Boris,
Use type long as primary data storage. Create calculated attribute with type Date on the same level as primary long attribyte and in getter put something like:
return new Date(valueFromUnixTimeStamp);
. WD runtime will take care abput formating (using user locale).
Best regards, Maksim Rashchynski.
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.