MINUTE FROM NUMTODSINTERVAL( formatting - oracle

I don't see anything on the oracle docs saying how to change the formatting of the output of a numtodsinterval function so I was hoping you could help
EXTRACT(MINUTE FROM NUMTODSINTERVAL(TOTAL_HOURS, 'HOUR'))
I would like this to come out in a two digit format :'MM', now it works in converting 1.25 into 1:15 but if the time is 8.1333 it displays 8:8
thanks!

Hey sorry yes you're right, I had not given enough information, I did want to display it in typical time fashion HH:MM, and also you are right it does return a number, I did not have a to_char , adding it made this a simple problem to solve so thank you!

Related

User facing date field granularity control

I'm trying to give my users the option to select the date field granularity of their choice, such as day, week, month or year. This is normally controlled on each graph in the menu show below but this isn't available in a published dashboard:
My first idea was to create a calculated field that truncates my desired date based on a parameter that I expose through a control. This would like something like this, truncDate(${intervalParameter}, {dateColumn}). The problem with this is that the first argument of the truncDate function must one of valid string literals and will throw an error before saving if it isn't.
Does anyone know of any other ways of achieving this? Or maybe some sneaky way of getting around the error?
I figured out a work around using ifElse.
ifElse(
${intervalParameter} = 'Day', truncDate("DD", {dateColumn}),
${intervalParameter} = 'Week', truncDate("WK", {dateColumn}),
${intervalParameter} = 'Month', truncDate("MM", {dateColumn}),
truncDate("DD", {dateColumn})
)
There might be better solutions out there but this is what I've come up with.

Kendo DateTimePicker, after parsing the Date the Year is Incorrect

Good Afternoon Fellow Code Monkey's
I'm new to StackOverflow, and Kendo UI programming. My problem is as follows. When trying to parse the date, and everything seems to work correctly until I get to the year portion.
here is my Javascript Code
$('#datepicker').kendoDatePicker({
format: 'MM dd yyyy',
parseFormats:['M/d/yy', 'MM/d/yy', 'MM/dd/yy', 'M/dd/yy', 'M/d/yyyy', 'MM/d/yyyy', 'MM/dd/yyyy','M/dd/yyyy','Mdyy','MMdyy', 'MMddyy', 'Mdyyyy', 'Mddyyyy', 'MMddyyyy', 'M-d-yy', 'MM-d-yy', 'MM-dd-yy', 'M-dd-yy', 'M-d-yyyy', 'MM-d-yyyy', 'MM-dd-yyyy', 'M-dd-yyyy']
});
Basically I want the user to be able to type the date into the Datepicker in any format, from 05052012 to 5/5/2012, etc and then the box formats. The above code for instance when entering "05052012" returns in the box 05 05 2020. Is there something wrong with how I have the year set up?
Thanks in advance,
SithApprentice
I think I have it figured out, seems sort of silly now. Apparently it has to do with the order in which I'm passing the formats with which I will be paresing. those with yy must come at the end, and those with yyyy must come at the beginning. I really wishTelerik mentioned this in their API Reference section for the date picker. From theier examples they make it seem like the order does not matter.

switch and/or iff function in SSRS. How to use both or any for two given columns

How to use =SWITCH & IIF condition to change color in SSRS if the condition is met. I have two columns “ScheduledDate” (which is date/time), and Activity(which is text format). I want to change the color of Activity (which has the output as Complete, Current, Overdue), if the ScheduledDate is greater than today’s date, then I want to change the Overdue data in Column Activity to RED.
Should using Switch would be good or IIF. How? Can anyone please give an example?
Appreciate any help on this one.
Thanks,
Niki
In this scenario, if you only need set RED without setting multiple color for fields, it's better to use IIF(). Base on your condition, try the expression below:
=IIF(Fields!ScheduleDate.Value>Now() and Fields!Activity.Value="Overdue",Red,Black)
I think I figured it out. It works. Thanks for your help.
=iif(Fields!ScheduleDate.Value > Now() and Fields!Activity.Value ="Cancelled","Red",
iif(Fields!ScheduleDate.Value < Now() and Fields!Activity.Value ="Created","Green","Red"))

Possible to have a simple formula within the [value_if] argument? - excel

I'm trying to use a relatively basic IF function but having no luck - i'm sure i just have brackets or parenthesis wrong or something. Reckon it will be childsplay for you guys....
The formula is intended to show how many days a date has passed by. Date is shown in T column.
Basically it was working fine as the following, both for pending and past dates:
=IF(T7<=TODAY(), (TODAY()-T7),-(T7-TODAY()))
But I got greedy and wanted it to return more of a statement when the date has passed, as to how much it has passed by. So I've tried to make this happen with:
=IF(T7<=TODAY(),"EffOut(TODAY()-T7) days ago",-(T7-TODAY()))
Hoping it would enter "EffOut 8 days ago" (when TODAY()-T7 is 8 days) for example.
But it doesnt - it shows the entire argument i.e "EffOut(TODAY()-T7) days ago" in the return cell.
Is it possible to have a kind of embedded formula in the 'value_if' fields, mixed with text in this sense?
Happy to share the document if that would help, but will need to clear the data first so just let me know.
Thanks in advance, any help is much appreciated! Having read other posts I think it will just be a simple fix but its well beyond me! (I only got this far by perusing forums...)
Maybe something like this...
=IF(T7<=TODAY(),"EffOut "&DAYS(TODAY(),T7)&" days ago",-(T7-TODAY()))
=IF(T7<=TODAY(),"EffOut "&(TODAY()-T7)&" days ago",-(T7-TODAY()))
You just need to be careful to put "" around any strings. This is how Excel knows that's not a part of the formula. Remember to out the spaces is to the string like I did above so it looks like a sentence. The & sign combines the results of the calculated parts and the strings.

Is there any way in XQuery to get the current time in milliseconds since some Epoch?

XQuery offers various date/time functions like current-dateTime(), however I can't seem to find one which gives me the time in milliseconds since Epoch. Functions to extract hours, minutes and seconds seem to exist too individually.
What is the right way to get the Epoch time (i.e. unix time or similar) in XQuery?
(current-dateTime() - xs:dateTime("1970-01-01T00:00:00-00:00")) div xs:dayTimeDuration('PT0.001S')
returns the number of seconds as a duration, and then divides by 1 millisecond to get the number of milliseconds as a number.
thank you for the tips. I modify the code for Oracle Service Bus 11g (OSB 11g) Xpath editor in case someone else needs it
{ (fn:current-dateTime() - xs:dateTime("1970-01-01T00:00:00-00:00")) div xdt:dayTimeDuration("PT0.001S") }
Additional tricks on Aditya's answer for OSB 11g.
There has an annoying bug on XQ Editors that will change div and operator into a , (comma).
Just put a conversion function in front of that code. such as xs:long, xs:string
ex.
{ xs:long((fn:current-dateTime() - xs:dateTime("1970-01-01T00:00:00-00:00")) div xdt:dayTimeDuration("PT0.001S")) }

Resources