Problems formatting BigDecimal in JASPER [duplicate] - jasper-reports

This question already has answers here:
How to display a number with always 2 decimal points using BigDecimal?
(7 answers)
How do I format a number in Java?
(9 answers)
Closed 4 days ago.
i have a problem with money format in Jasper. i live in Brazil, so my format Money is different... In United States the moneys is xx,xxx.xx in Brazil is xx.xxx,xx. Now, my problem:
Right now i use a variable to format my money, but show the R$, in this case i don't want the R$, i just want the money. this is my variable:
<variable name="currency_format" class="java.text.DecimalFormat" calculation="System">
<initialValueExpression><![CDATA[(DecimalFormat) NumberFormat.getCurrencyInstance(new Locale("pt", "BR"))]]></initialValueExpression>
</variable>
Using in a field: $V{currency_format}.format($F{valor_empenho})
i know if i change the "getCurrencyInstance" to "getNumberInstance" i resolve my problem, but he "eat" the two number at the final money like: 28.600,00 to 28.600, i really want the two zeros after my money. So i tried use a new.java.text.DecimalFormat to resolve this, and worked! But In Jasper.... In live server, he goes to EUA money, image here: Money with java text decimal format in server. The "pattern" in jasper dosen't work for me, just the variable, here a image Money with variable. Someone can help me with this?

Related

What type of date string is this? `20210713T015433.354Z` [duplicate]

This question already has answers here:
What is this date format? 2011-08-12T20:17:46.384Z
(11 answers)
Closed 1 year ago.
I'm working with some data where I don't know how the time string was generated but an example of what the date string looks like is this 20210713T015433.354Z
I've looked at some examples of date strings (ex1 and ex2) but haven't had any luck decoding it.
I know that the first half of the string is YYYYMMDD, and then I think that T means times but then I don't know what 015433.354Z is.
My eventual goal is to make this into a Date objects in JS but I can't deduce the formatting. beyond the day it occured.
The date format provided is ISO 8601. Maybe you want to try the following to get a Date object:
new Date(Date.UTC(2021, 7, 13, 1, 54, 33, 354))
As pointed in this SO answer.

spss-modeler date difference getting negative results

First of all, I'm new to SPSS modeler, sorry if my question sound too obvious for experts, but what I'm trying is to calculate the date difference between two date values ( arrive_Date , Depart_Date ) in (Hours), I used this function time_hours_difference , this function works okay if the Arrive_Date and depart_date are the same day, but if the days are different, the date difference is in negative value, I searched and enabled this option: Rollover days/mins in stream properties, but the problem remains the same.
I hope you can help me with this beginner question.
Thanks
Hope its not too late. You are getting negative values because time_hours_difference extract only the time from the two specified timestamps and computes the difference out of it. It doesn't take the date values into account.
For example:
time_hours_difference('2012-08-02 14:10:50,2012-08-05 13:36:26)
Output:
-0.573
Remember, here time_in_hours('0130') under time format 'HHMM' evaluates to 1.5.
Here is my solution: in order to take days into account, first extract date_days_difference and multiply it with 24 to bring it in Hours and then sum it up with the time difference using time_hours_difference.
date_days_difference(arrive_Date,Depart_Date)*24 +
time_hours_difference(arrive_Date,(to_string(datetime_date(arrive_Date)) >< " 23:59:00")) +
time_hours_difference((to_string(datetime_date(Depart_Date)) >< " 00:00:00"),Depart_Date)

Google spreadsheet month name (MMMM) without declension

I want to display formatted month name in the basic form (nominative) as a label. In Czech language (and several next Slavic languages) we use declension. So if I use =TEXT(NOW();"MMMM") the cell shows month name in genetive instead of nominative (i.e. srpna instead of srpen).
Q: How to format the date in the nominative? The acceptable solution will offer some native way how to solve it but not:
manipulating with strings (month names are too complex)
having some another list with month names
calling own formula (Google script)
Maybe there is no native way how to solve this and it will be implemented in the future, so Google Script seems to be the easiest hotfix for now. And because I'm expecting many answers with the script, I'm putting the one here but this question is not about the javascript/google-script.
function monthName(date) {
var months = ["Leden","Únor","Březen","Duben","Květen", "Červen","Červenec","Srpen","Září","Říjen","Listopad","Prosinec"];
return months[date.getMonth()];
}

DATEDIF statement in SharePoint not working properly

I am trying to calculate the amount of days between two dates but my formula doesn't seem to be working properly. It's as is the function is ignoring the years in the dates. My function is as follows:
=IF([Today's date]>[Expiration Date],-DATEDIF([Expiration Date],[Today's date],"d"),(DATEDIF([Today's date],[Expiration Date],"d")))
I receive this error if I use the above function(Owners removed):
But then I replace -DATEDIF([Expiration Date],[Today's date],"d") with -DATEDIF([Today's date],[Expiration Date]"d") i get this result:
This is telling me that both cases are being treated as IF([Today's date]>[Expiration Date] even though 3/24/2015 is clearly larger than 11/03/2014. Can somebody please tell me what I'm doing wrong? Thanks.
=[ExpirationDate] - [TodaysDate]

sqlite writing a date into an email

I am exporting a date value from sqlite and placing it into an email. The date appears like this
279498721.322872
I am using Objective C in an Iphone App. Does anyone know how to make this export out as a regular date whether it is all number like
2009-02-10 or anything legible?
Well, if you take the number 279498721.322872 and throw it into an NSDate object using +dateWithTimeIntervalSinceReferenceDate, you get (here in the MDT timezone): 2009-11-09 15:32:01 -0700, which was just under 4 hours ago. If that's the time you're expecting, then formatting it is as simple as using an NSDateFormatter.
However, the thing to notice is that sqlite (by default) stores dates as textual representations (unless you specify differently in the sql statement). So the real question here is "where are you getting that number from?"
echo date("Y-m-d",time(279498721.322872));
Thanks for the responses. The answer came from my Guru Alex Cone. He told me to use the following:
NSTimeInterval tempInterval = (NSTimeInterval)sqlite3_column_double(statement, 4);
The tempInterval variable can then be loaded into the the NSDate method.