1.18.0 date.extract - function does not work correctly? (1 Viewer)

123vak123

Portal Pro
December 13, 2010
207
161
Minsk
Home Country
Belarus Belarus
MediaPortal Version: 1.18.0

Description
I tried to extract the values of hours and minutes by the function "data extract" from the tags #currentremaining and #durathion. If the tag value is more than one hour, then the function works normally (see screenshot 1). If the tag value is less than one hour, the function returns 0 (or is it the error value?) for both hours and minutes (see screenshot 2 and 3). But for some files "date.extract('h',cdate(#currentremaining))" returns minutes, "date.extract('n',cdate(#currentremaining))" - seconds (see screenshot 4).

What it could be: bug or feature of the function?

Steps to Reproduce:
I do not know yet what to write here. The problem was revealed during the discussion of the topic Is it possible to add two time values?
 

Attachments

  • screenshot 1.png
    screenshot 1.png
    620.1 KB
  • screenshot 2.png
    screenshot 2.png
    1.2 MB
  • screenshot 3.png
    screenshot 3.png
    877.2 KB
  • screenshot 4.png
    screenshot 4.png
    1.6 MB

ajs

Development Group
  • Team MediaPortal
  • February 29, 2008
    15,620
    10,548
    Kyiv
    Home Country
    Ukraine Ukraine
    cdate work fine for format: HH:mm:ss if string like: 53:50 then C# Believes what needs to be transformed 53 hour and 50 minutes to DateTime ... and return Error value. if string like: 00:53:50 then work fine ...
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,620
    10,548
    Kyiv
    Home Country
    Ukraine Ukraine
    I add functions, then you can analyze what you want.
    string.length
    cdate(string, format)
    ctimespan(string, format)

    And then ....
    If length(currenremaining) < 6 then ctimespan(currentremaining, "mm:ss") else ctimespan(currentremaining, "h:mm:ss") etc, etc :)

    --
    WBR, ajs
     

    123vak123

    Portal Pro
    December 13, 2010
    207
    161
    Minsk
    Home Country
    Belarus Belarus
    Super. Thank you very much. New functions will be included in 1.19Pre? Or can I download the test build somewhere?
     

    ajs

    Development Group
  • Team MediaPortal
  • February 29, 2008
    15,620
    10,548
    Kyiv
    Home Country
    Ukraine Ukraine
    For cdate with format parameters see Standard Date and Time Format Strings and Custom Date and Time Format Strings
    for ctimespan with format parameters see Standard TimeSpan Format Strings and Custom TimeSpan Format Strings

    Code:
    string.length(string)
    Return string Length.

    Code:
    cdate(value,format)
    Convert value to date with format of value. If value is not a valid date, reutrns an error.

    Code:
    ctimespan(value)
    Convert value to ctimespan. If value is not a valid ctimespan, reutrns an error.

    Code:
    ctimespan(value,format)
    Convert value to ctimespan with format of value. If value is not a valid date, reutrns an error.
     

    Users who are viewing this thread

    Top Bottom