1.18.0 - date.extract - function does not work correctly?

Discussion in 'Archive' started by 123vak123, October 16, 2017.

  1. 123vak123

    123vak123 Portal Pro

    Joined:
    December 13, 2010
    Messages:
    175
    Likes Received:
    70
    Gender:
    Male
    Location:
    Minsk
    Ratings:
    +136 / 2
    Home Country:
    Belarus Belarus
    Show System Specs
    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?


     

    Attached Files:

  2. Google AdSense Guest Advertisement



    to hide all adverts.
  3. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,417
    Likes Received:
    2,504
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,424 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    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 ...
     
    • Thank You! Thank You! x 1
  4. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,417
    Likes Received:
    2,504
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,424 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    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
     
    • Thank You! Thank You! x 1
  5. 123vak123

    123vak123 Portal Pro

    Joined:
    December 13, 2010
    Messages:
    175
    Likes Received:
    70
    Gender:
    Male
    Location:
    Minsk
    Ratings:
    +136 / 2
    Home Country:
    Belarus Belarus
    Show System Specs
    Super. Thank you very much. New functions will be included in 1.19Pre? Or can I download the test build somewhere?
     
  6. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,417
    Likes Received:
    2,504
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,424 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    I hope, but I'm afraid that I will not be able to properly check them.
     
  7. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,417
    Likes Received:
    2,504
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,424 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    JIRA MP1-4893 Branch updated ...
     
  8. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,417
    Likes Received:
    2,504
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,424 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    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 (Text):
    1. string.length(string)
    2. Return string Length.
    Code (Text):
    1. cdate(value,format)
    2. Convert value to date with format of value. If value is not a valid date, reutrns an error.
    Code (Text):
    1. ctimespan(value)
    2. Convert value to ctimespan. If value is not a valid ctimespan, reutrns an error.
    Code (Text):
    1. ctimespan(value,format)
    2. Convert value to ctimespan with format of value. If value is not a valid date, reutrns an error.
     
  9. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,417
    Likes Received:
    2,504
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,424 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    For 1.17 I can give you a test library. :):whistle::coffee: Or a little later, if I have time and I will not forget, then for 1.18 :D
     
    • Thank You! Thank You! x 1
  10. 123vak123

    123vak123 Portal Pro

    Joined:
    December 13, 2010
    Messages:
    175
    Likes Received:
    70
    Gender:
    Male
    Location:
    Minsk
    Ratings:
    +136 / 2
    Home Country:
    Belarus Belarus
    Show System Specs
    Ready to wait for version 1.18.
     
    • Like Like x 1
  11. ajs
    • Team MediaPortal

    ajs Development Group

    Joined:
    February 29, 2008
    Messages:
    8,417
    Likes Received:
    2,504
    Gender:
    Male
    Occupation:
    IT
    Location:
    Kyiv
    Ratings:
    +4,424 / 29
    Home Country:
    Ukraine Ukraine
    Show System Specs
    Try ...
     

    Attached Files:

    • Core.dll.zip
      File size:
      1 MB
      Uploaded:
      October 27, 2017
      Views:
      50
    • Thank You! Thank You! x 2
Loading...

Users Viewing Thread (Users: 0, Guests: 0)

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice
  • About The Project

    The vision of the MediaPortal project is to create a free open source media centre application, which supports all advanced media centre functions, and is accessible to all Windows users.

    In reaching this goal we are working every day to make sure our software is one of the best.

             

  • Support MediaPortal!

    The team works very hard to make sure the community is running the best HTPC-software. We give away MediaPortal for free but hosting and software is not for us.

    Care to support our work with a few bucks? We'd really appreciate it!