Pointui » Home 2 Scripting Support

Date and String functions

(7 posts)
  • Started 1 year ago by zenkinz
  • Latest reply from zenkinz
  • This topic is not a support question
  1. Hi,

    I need to destress so I thought I would try my hands on applet development. I am trying to create a calendar applet, but hit some basic scripting problem.

    1. In order to determine if leap year, I would need division mod but I don't think that's supported in PointUI scripting engine.

    2. I also need to extract the year and month from a DateTime object, in integer value. It looks like DateTime only supports ToString, but String object does not have ToInteger or similiar method.

    Posted 1 year ago #
  2. Hi zenkinz, our underlying DateTime functionality has leap year support in it, so we just need to expose that in script. Have added to list to do. It also has GetYear(), GetMonth() etc. Probably by next release.

    Posted 1 year ago #
  3. Thanks, looking forward to it ;-)

    Posted 1 year ago #
  4. The following have been added for next release:
    IsLeapYear(), IsSameDay(), GetDay(), GetMonth(), GetYear(), GetHours(), GetMinutes(), GetSeconds(), GetDaysInMonth(), GetDayOfWeek(), GetTimeZoneOffsetMinutes().

    http://docs.pointui.com/DateTime

    And in regards to your ToInteger question - our underlying datetime functionality stores the value in a 64bit integer as the number of 100 nanoseconds (think that was it - was a few years ago I built it now) since year 0001 however we don't have support for 64bit ints in script at the moment. Hopefully with the additions the DateTime class is now self sufficient though.

    Posted 1 year ago #
  5. Joel, the ToInteger method is more for the String object, e.g. for string object "1", the ToInteger returns a 1. That said, when I ask for this method, it's because there's no way I can get the day, month, year, minutes, hours from the DateTime object in integer value, I thought I could get these information via String manipulation but would still end up in string format and not in integer format that's needed for further processing.

    So you are right, if those additional DateTime functionalities are provided, it should suffice, as far as creation of Calendar applet is concerned. :-)

    thanks for your wonderful response!

    Posted 1 year ago #
  6. For converting between strings and ints you don't need explicit conversion methods - I built some default assignment operators capable of handling it so you can just do:


    String s = 1;
    int i = "123";

    i = s;
    s = i;

    Posted 1 year ago #
  7. oh didn't know about that implicit conversion. Thanks!

    Posted 1 year ago #

RSS feed for this topic

Reply

You must log in to post.