days calculation between two dates on Eclipse Birt Report - eclipse

Can anyone help me about days calculation on eclipse birt reporting. days calculation between Date today less Pr approved date.
my code goes like this:
sqlText = sqlText + " days (BirtDateTime.today() - days (prstatusappr.changedate) as prapprdate ";
It's not working. please help. Thanks

BirtDateTime class provides functions for multiplication, division, addition, subtraction, and so on.
you can use it for your purpose.
BirtDateTime.diffDay("2019-03-19",BirtDateTime.today())
Ex.
sqlText="Difference is "
sqlText = sqlText+" :" +BirtDateTime.diffDay( "2019-03-19",BirtDateTime.today())
BIRT Field Guide ref.
https://help.eclipse.org/mars/topic/org.eclipse.birt.doc/birt/ScriptingReference.24.4.html

Related

Years of Service Formula in Google Sheets

How do I create a formula for years of service in Google Sheets?
This formula is giving me an error in Google Sheets.
=DATEDIF((B6,"7/10/2019", "Y")&" years")
I wish to have the output state "10 years". I also need to put the end date as TODAY, but when I input Today() as a date, the formula does not work.
try:
=DATEDIF(B6; TODAY(); "Y")&" years"
Too many brackets... try
=DATEDIF(B6,"7/10/2019", "Y")&" years"

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)

Conditional Formatting in SSRS

I am a bit new with SSRS, I need to do a conditional formatting in SSRS, where if the last_backup_date is less than 3 days, the column will be "Yellow" and if it is less than 7 days, then the column will be "Red"... I can't figure out how to do this. Any help would be appreciated. I tried using Switch function but just can't figure out which Date & Time function to use here. Thanks in advance
Try using this:
=Switch(
DATEDIFF(DateinterVal.Day,Fields!last_backup_date,Today())<3,"Yellow",
DATEDIFF(DateinterVal.Day,Fields!last_backup_date,Today())<7,"Red"
)
UPDATE: Adding an additional condition based on comments.
=Switch(
DATEDIFF(DateinterVal.Day,Fields!last_backup_date,Today())<3,"DarkGreen",
DATEDIFF(DateinterVal.Day,Fields!last_backup_date,Today())<=7,"Yellow",
true,"Red"
)
Let me know if this helps.

Formatting a date retrieved from Wikidata

So let's say I have an Infobox template in Wikipedia that retrieves a company foundation date from Wikidata. It contains the following code:
|label7 = Year founded
|text7 = {{wikidata|p571|{{{founded|}}}}}
My problem is that what's retrieved is formatted as 31 January 2010 and it looks weird next to "Year founded' since it is not a year but the whole date. Of course I could rename the label from "Year founded" to "Date founded" and voila, problem solved, right? But I do want to just get the year from Wikidata, not the whole date.
What would be the code for this? I imagine something like {{wikidata|p571[year]|{{{founded|}}}}} or {{wikidata|p571[0]|{{{founded|}}}}} or {{wikidata|p571[YYYY]|{{{founded|}}}}}.
Thanks in advance!
This doesn't sound like a programming question, but it looks like you can request a specific date format as the third parameter to wikidata
https://en.wikipedia.org/wiki/Module:Wikidata#Testing_getValue.2C_getRawValue_and_getDateValue
{{#invoke:Wikidata|getDateValue|P569|FETCH_WIKIDATA|y}}
I highly recomend you to filter the year from date using RegularExpression instead of trying to get only the year.

SSRS Current Month Parameter

I have cascading date parameters year, month, date. I want SSRS to dynamically populate the current month automatically.
For year I used ="[Date].[Year].&["+CSTR(Year(Today))+"]" and worked fine.
For Month I used ="[Date].[Month].&" & Format(Today(), "YYYYMMMM") and IS NOT working.
My Month Parameter format is: 2016 September
Thanks in advance for your help.
Try:
="[Date].[Year].[Month].&["+ Cstr(Today.Year) + " " +
StrConv(MonthNAme(Today.Month),vbProperCase) +"]"
Also this should work
="[Date].[Year].[Month].&["+ StrConv(FORMAT(Today(),"yyyy MMMM"),vbProperCase) +"]"
Let me know if this helps.
You could probably try and use the CDATE function:
=Format(CDATE(Today()), "yyyy MMMM")