If you need to format dates and numbers into a locale-sensitive string or if you just need to convert data between different types then take a look at psdi.util.MaxType class.
For example, the following piece of code shows how to correctly format a currency amount into a string.
MaxType mt = new MaxType(MaxType.AMOUNT); mt.setValue(10.1234); String s = mt.asLocaleString();
Hi,
ReplyDeletethanks for this article. It points me in the right direction, however as Java dummy I have big problem with converting a date.
I need to copy DATETIME field into DATE field. I tried setValue("DATEFIELD", getDate("DATETIMEFIELD")); but this fails with "Date format invalid" whenever locale is set to anything else than "us". How to make it work? Can you support me?
Interesting...
DeleteI have tried this code and it works:
Date d = asset.getDate("STATUSDATE");
asset.setValue("INSTALLDATE", d);
Where STATUSDATE is a DATETIME and INSTALLDATE is a DATE.
Where are you setting the locale?
Hi Bruno,
ReplyDeletethanks for the prompt answer!
Now it works! It seems that the cast made a huge difference.
Thanks a lot!
Robert
This comment has been removed by a blog administrator.
ReplyDeleteHi Bruno,
ReplyDeleteAlso, you can use following code:
String s = psdi.util.MXFormat.amountToString(10.1234);
Kind Regards,
Max.
Nice post. Thanks for sharing the valuable information. it’s really helpful. Who want to learn this blog most helpful. Keep sharing on updated posts…
ReplyDeleteData Science training in Chennai
Data science training in Bangalore
Data science training in pune
Data science online training
Nice post. Thanks for sharing! I want people to know just how good this information. It’s interesting content and Great work.
ReplyDeleteThanks & Regards,
VRIT Professionals,
No.1 Leading Web Designing Training Institute In Chennai.
And also those who are looking for
Photoshop courses training institutes in Chennai
PHP & Mysql courses training institutes in Chennai
SEO courses training institutes in Chennai
Testing courses training institutes in Chennai