xsl if test if the timestamp is within the past 24 hours - xslt-1.0

I would like to check if the processed date is today.
xsl:if test="ProcessedDate = 'Today'" won't work since the value of processed date is a timestamp more like 2016-06-07T09:06:54.827z
How can I mathematically convert it to check the processed date to see if it's in the past 24 hrs.
Perhaps within a ().

Related

How to adding month to date in and return in Date format in Robot Framework

I try to calculate month.
My Example code: 27/01/2020 + 20 months
Test Date
${PAYMENTDATE} Set Variable 27/01/2020
${PAYMENTDATE} Convert Date ${PAYMENTDATE} date_format=%d/%m/%Y result_format=%Y-%m-%d
${DATE} Add Time To Date ${PAYMENTDATE} 20 months result_format=%d/%m/%Y
log to console ${DATE}
But it not work, Could anyone help please?
In your code you are providing time value in months which is not valid. Unfortunately adding months to the date is not possible using the Robotframework DateTime library. From the DateTime documentation:
time: Time that is added in one of the supported time formats.
You need to provide the time value in one of the possible way e.g. You can provide days.
20 months approximates to 600 days and below code works without problem.
${DATE} Add Time To Date ${PAYMENTDATE} 600 days result_format=%d/%m/%Y
In case you are looking for exact days to be added for 20 months than you need to calculate exact number of days starting from the date you want to add 20 months to and provide it in above code instead of 600 days. You can easily find answers on how to calculate exact days using python like this here.

Starttime and endtime

i have paramters fields as starttime(=DateAdd("d",-1,now())) and endtime (now()) and status( as dropdown ex:running,succededtec,.) in my report.... when i run the report with the whole timestamp it is working as expected but if i give only date in both the fields without time then am not getting last one days data( for example if starttime is 6/14/2017 and endtime is 6/18/2017 am getting data till 6/17/2017 only) .....one more scenario is when I have no endtime (like status is running we have no endtime) then am getting that.Can anyone help me out.
Thanks
The time defaults to 00:00:00 if not included.
So basically when you're comparing say
06-18-2017 07:52:11 <= 6-18-2017
you're actually comparing
06-18-2017 07:52:11 <= 6-18-2017 00:00:00
Since the time defaults to zero, and you will never get any 6-18 results returned unless they happened at exactly midnight. Set the timestamp in your compare, or use 6-19 as your compare date instead (with the risk of including a random record that happened at exactly midnight on 6-19).

sql Sum time that occurs in an interval

i have a lot of data that has at start time and a finnish time. These are formated i datetime format.
i want to sum the time that occurs in an timeinterval
if specify the time interval 08-11
i only want to get the time between these to even if the evvent progresses from 06 to 12
If you are using SQL Server you could do it like that:
SELECT SUM(DATEDIFF(HOUR,StartTimeColumn,EndTimeColumn)) AS ElapsedHoursTotal,
SUM(DATEDIFF(MINUTE,StartTimeColumn,EndTimeColumn)) AS ElapsedMinutesTotal,
SUM(DATEDIFF(SECOND,StartTimeColumn,EndTimeColumn)) AS ElapsedSecondsTotal,
FROM dbo.YourTable
You will have to find the perfekt interval (First Parameter of DATEDIFF Function) for your requirements... Hours, Minutes, Seconds, Nanoseconds,...
Im using mssql 2012
the problem is that i can get the full elapsed time from start to finnish but I only want the part that matches my search
if the pattern i match for is 8-11
thing one 08-12 should produce 3 hours
thing two 10-11 should produce 1 hour
thing tre 9.30- 14 shoud produce 1.5 hour

datetime manipulation: replace all dates with 00:00 time with 24:00 the previous day

I have a table described here: http://sqlfiddle.com/#!3/f8852/3
The date_time field for when the time is 00:00 is wrong. For example:
5/24/2013 00:00
This should really be:
5/23/2013 24:00
So hour 00:00 corresponds to the last hour of the previous day (I didn't create this table but have to work with it). Is there way quick way when I do a select I can replace all dates with 00:00 as the time with 24:00 the previous day? I can do it easily in python in a for loop but not quite sure how to structure it in sql. Appreciate the help.
All datetimes are instants in time, not spans of a finite length, and they can exist in only one day. The instant that represents Midnight is by definition, in the next day, the day in which it is the start of the day, i.e., a day is closed on its beginning and open at its end, or, to phrase it again, valid allowable time values within a single calendar date vary from 00:00:00.00000, to 23:59:59.9999.
This would be analogous to asking that the minute value within an hour be allowed to vary from 1 to 60, instead of from 0 to 59, and that the value of 60 was the last minute of the previous hour.
What you are talking about is only a display issue. Even if you could enter a date as 1 Jan 2013 24:00, (24:00:00 is not a legal time of day) it would be entered as a datetime at the start of the date 2 Jan, not at the end of 1 Jan.
One thing that illustrates this, is to notice that, because of rounding (SQL can only resolve datetimes to within about 300 milleseconds), if you create a datetime that is only a few milleseconds before midnight, it will round up to midnight and move to the next day, as can be seen by running the following in enterprise manager...
Select cast ('1 Jan 2013 23:59:59.999' as datetime)
SQL server stoers all datetimes as two integers, one that represents the number days since 1 Jan 1900, and the other the number of ticks (1 tick is 1/300th of a second, about 3.33 ms), since midnight. If it has been zero time interval since Midnight, it is stll the same day, not the previous day.
If you have been inserting data assuming that midnight 00:00:00 means the end of the day, you need to fix that.
If you need to correct your existing data, you need to add one day to every date in your database that has midnight as it's time component, (i.e., has a zero time component).
Update tbale set
date_time = dateAdd(day, 1, date_time)
Where date_time = dateadd(day, datediff(day, 0, date_time), 0)

Objective-C – Check if a repeating date will clash with another date

I have two NSDate objects. One (call it date1) has timestamp in the future i.e 2012-07-16 12:00 and also this date is repeating daily. The other one (date2) has a timestamp also in the future i.e 2012-07-17 12:00.
Now I want to check if possibly date1 will clash with date2. Obviously it will not clash at 2012-07-16 12:00 but the day after (since it's repeating daily) it will clash with date2.
How could I implement this check?
First check if the events would overlap on any date, i.e. using only the starting time and length of the events. If they do, then check if the dates are the same, or if the earlier of the dates is for an event that repeats enough times to occur on the date of the second event.
To compare the times you can use something like this to extract the hours and minutes from the NSDates: How do I get hour and minutes from NSDate?
For the second check you can first use NSDate's compare, followed by a timeIntervalSinceDate which you feed into something like this: How do I break down an NSTimeInterval into year, months, days, hours, minutes and seconds on iPhone? to get the number of days between the two dates, which you then can compare against the repeat count of the event.