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

123vak123
Country flag

Portal Pro
December 13, 2010
176
135
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

ajs
Country flag

Development Group
  • Team MediaPortal
  • February 29, 2008
    10,461
    5,626
    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
    Country flag

    Development Group
  • Team MediaPortal
  • February 29, 2008
    10,461
    5,626
    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
    Country flag

    Portal Pro
    December 13, 2010
    176
    135
    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
    Country flag

    Development Group
  • Team MediaPortal
  • February 29, 2008
    10,461
    5,626
    Kyiv
    Home Country
    Ukraine Ukraine
    JIRA MP1-4893 Branch updated ...
     

    ajs
    Country flag

    Development Group
  • Team MediaPortal
  • February 29, 2008
    10,461
    5,626
    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 (Users: 0, Guests: 1)

    Thread starter Similar threads Forum Replies Date
    D3ltoroxp Archive 11
    Top Bottom