Skip to content

DATESTR

Forums Forums SIMPOL Programming DATESTR

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #77
    JD Kromkowski
    Participant

    There is clearly continues to be a problem with how dates are being handled. Changing a field from a string to a date (Modify Table) and/or trying to change the display format and/or change index status: either doesn’t work or creates errors (Error 18 in IDE which specifies problem as being in DATESTR or a shutdown in Personal) on any of the selects, e.g f.selectfirst() or f.selectnext(). JDK

    #1606
    Michael
    Keymaster

    JDK wrote:
    > There is clearly continues to be a problem with how dates are being
    > handled.
    >
    > Changing a field from a string to a date (Modify Table) and/or trying
    > to change the display format and/or change index status: either
    > doesn't work or creates errors (Error 18 in IDE which specifies
    > problem as being in DATESTR or a shutdown in Personal) on any of the
    > selects, e.g f.selectfirst() or f.selectnext().

    This actually sounds more like a problem with the code that handles a
    field type change in the file modification tool in SIMPOL Personal.
    Could you describe it for me a little more precisely in terms of what
    the data type was before, what it was after, what the display format
    contained before and after, etc? Also, was there already data in the
    table when you changed it? When you changed it, at what point did it
    start causing problems?

    Ciao, Neil

    #2141
    Michael
    Keymaster

    On 27/02/2013 17:40, JV wrote:
    > Ben banging my head over this for 4 hours.
    > Time to ask a stupid question…
    >
    > How do you convert date field to string?
    >
    > string = DATESTR (r!Datefield, "mm/0d/yyyy") give me a wrong type error.
    >
    > also tried integer = DAYS(r!Datefield)
    > string = DATESTR (integer, "mm/0d/yyyy")
    >
    > Any help will be appreciated!

    Hi Jean,

    This is unfortunately not as obvious as it should be, but the return value of r!Datefield is not a date object, it is the value of
    a date object (internally an integer). As such, you need to use this:

    string = DATESTR(date.new(r!Datefield), "mm/0d/yyyy")

    Sorry about this, but it is probably the only case where this confusion happens. We could change DATESTR() but that would break
    too much else, and there are many places where you actually have a date object that also call this function.

    Ciao, Neil

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.