Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

[solved] Playing with time



  • Hi,

    I haven't seen any function to play with time, i wonder if is it possible. What i'm looking for is some funtions like that :
    

    @if(time1.isbefore(time2)) ...
    var intVar = time1.secTo(time2) ....@

    In a same way is there any function for handling string like find, substr or charAt ? It would prevent me from reinventing the wheel and creating a C++ extension for so few. Or at least, is it possible to create a library of functions accessible from javascript without creating QML object? Because as far as I understood it we can only register qml type.

    Thanks in advance.



  • It's just standard EcmaScript. All standard objects are available. Take look at the "Mozilla Reference":http://developer.mozilla.org/en/JavaScript/Reference . For instance @(new Date()).getTime())@ delivers the number of miliseconds since begin of Epoch.



  • Thanks a lot. That would be great if this information was on the doc.


Log in to reply