How to show time difference of hours which are greater than 24 hours? - datetime

I'm facing difficulties to show the time time difference in hours where hours are greater than 24.
Right now I'm using the following in iReport
(new SimpleDateFormat("dd':'HH':'mm':'ss")).format(new Date($V{avgDuration}.longValue()*1000))
where $V{avgDuration} is a variable in jrxml file which is the average time difference between two dates in seconds. Here it shows the 1 day 1 hour but I want it to be 25 hour. What should I do?

I've solved the problem using PeriodFormatterBuilder. But for this, I need to use joda-time library.
In the expression editor of the text box in jrxml file, just wrote the following:
new org.joda.time.format.PeriodFormatterBuilder()
.printZeroAlways()
.minimumPrintedDigits(2)
.appendHours().appendSeparator(":")
.appendMinutes().appendSeparator(":")
.appendSeconds()
.toFormatter()
.print(new org.joda.time.Period(
$V{avgDuration}.longValue()*1000))

Related

${STRFTIME(${EPOCH},,%d/%m/%y %k:%M)}

how to print/noop next 2 day date
${STRFTIME(${EPOCH},,%d/%m/%y %k:%M)}
it's displaying the current date, need to display next 2-day date.
where can change be made to get an output of next two day after date?
for ex. today 10 June need to display 12 June
EPOCH is seconds since some date(depend of linux version).
So easy way is just add to EPOCH two days in seconds (60*60*24*2)

kibana timelion time zone issue

sorry if this is a newbie question but i have been having a very weird issue with my installation of kibana:
setting dateFormat:tz is set to UTC.
searches are working great and data is shown exactly as expected when the last minute in the graph is 3 hours before my local time (i'm at GMT+3 so it's accurate)
in time lion on the other hand I've been having an issue where i run a very basic time series like .es(*) and what i get is a graph where the last 3 hours is showing 0 entries. it seems that the timelion is not using the configured time zone for the graph limits but it is using the tz on the data.
any thoughts?
You need to set your data time field
.es(timefield=YOURFIELDNAME)

Duration and work concerning tasks in MS Project

i have a problem in MS Project 2013:
i´d like to set up a work package that has a certain duration but in this duration there is no work like 8 hours x (duration in days) required but e.g. 5 days of work in a timeframe of 30 days.
this is annoying to set up but it works. now ms project does not draw the respective bar for 30 days of duration but only for 5 days (the work). at the end of the bar a little arrows goes on for another 25 days (resulting in 5+25=30days) and then turns down to the next work package. i´d rather like to see a bar for the full 30 days and then for the arrow to go down.
is there a way to do this?
it seems wrong that the bar depends on the work rather than the duration because it is not likely that the work gets done in the first 5 days and then you just wait for 25 days.
Create a new task and set the Duration to 30d and make sure the type is "Fixed Duration" and set the task's Work to 40h.

add time plus and recalculate the datetime

I'm new into coding.
I'm using the echo %time% to get the time.
Now is my goal to add 4 hours to this time and create the output.
Nice would be to have the time only in hours and minutes.
It would help to tell you are working on a batch script, makes helping easier
You can split up the time in hours and minutes:
set hh=%time:~0,2%
set mm=%time:~3,2%
and add 4 hours:
set /A hh=%hh%+4
then concat them back together, and do not forget to fix it when the hours go above 24, a simple if statement would do fine then distract the 24 to get the right time

Set a date based on other dates?

I need to set a chart to start at midnight of the current day and end just before midnight of the next day...
I'm trying to do something like this:
minChartDate = currentDate.fullYear,currentDate.month,currentDate.date,0,0,0,0;
where currentDate:Date; is the day currently selected.
I'm getting an implicit coercion error between the Number to Date type, as if currentDate.fullYear is a Date, but according to the documentation it should be a number. Or is my syntax defining this incorrect? Also wondering if there's a simpler way to get the min and max dates than this!
(the reason I am setting this is so that it starts at midnight rather than at the first data point in the series).
I'm also getting a weird error 'maximum' values of type Date cannot be represented in text.. it said I need a Date type object for the minimum and maximum so I'm really not sure what it's talking about...
this code will make a date object set to 0:00 on today.
var minChartdate:Date= new Date();
minChartdate.hours=0;
minChartdate.minutes=0;
minChartdate.seconds=0;
minChartdate.milliseconds=0;
trace(minChartdate)
To make one for the next day:
var minChartdate:Date= new Date();
minChartdate.time = minChartdate.time+1000*60*60*24 // one day in milliseconds
minChartdate.hours=0;
minChartdate.minutes=0;
minChartdate.seconds=0;
minChartdate.milliseconds=0;
trace(minChartdate);
This script moves the date object forward by 24 hours, and then sets hours, mins,sec,milisecs to 0.
Note: This is not 100% correct solution, it can fail on days, when the hours are adjusted because of daylight saving time changes.

Resources