Forums › Forums › SIMPOL Programming › DATESTR
- This topic has 2 replies, 2 voices, and was last updated 11 years, 2 months ago by Michael.
- AuthorPosts
- October 12, 2009 at 8:51 pm #77JD KromkowskiParticipant
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
October 15, 2009 at 11:07 pm #1606MichaelKeymasterJDK 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
February 27, 2013 at 8:09 pm #2141MichaelKeymasterOn 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
- AuthorPosts
- You must be logged in to reply to this topic.