In OpenEdge there is support for creating ISO-formatted date strings using the new ISO-DATE function. However, I can't find any equivalent function for importing date strings from ISO format to a DATE variable.
The DATE(string) function insists that the string is in " the format specified by the Date Format (-d) startup parameter (the default is mdy)."
I want to export/import dates using the ISO date format.
Any suggestions?
so, now I need to do this as well
As it has been 7 years since this post, I was wondering if some new feature / function has snuck into the langauge ...
how can I convert an ISO-Date string back into a datetime or datetime-tz field ?
Yes, I have written conversion method. But it is yukky
jmls wrote:
so, now I need to do this as well
As it has been 7 years since this post, I was wondering if some new feature / function has snuck into the langauge ...
how can I convert an ISO-Date string back into a datetime or datetime-tz field ?
Yes, I have written conversion method. But it is yukky
Yukkier than this?
method static public datetime-tz ToABLDateTimeFromISO(input pcValue as character):
define variable cDateFormat as character no-undo.
cDateFormat = session:date-format.
session:date-format = 'ymd'.
return datetime-tz(pcValue).
finally:
session:date-format = cDateFormat.
end finally.
end method.
-- peter
meh. from the manual
...Typical values are "mdy" or "dmy". This attribute provides the same functionality as the Date Format (-d) parameter.
guess I missed the "Typical" and never tried any other format apart from mdy or dmy
Thanks !
guess I missed the "Typical" and never tried any other format apart from mdy or dmy
Another episode from the ABL hidden treasures.
I also learned it from Peter's AutoEdge foundation routines (for OE BPM) and not from the docs. There is some valuable stuff in his code.
Mike I downloaded Autoedge as well, primarily to look for some good oo examples. We are all of us starved for code examples with Openedge.
...well at least I am.
Here is another way but not as efficient but an interesting use of the new JSON tools in OE11
define variable oJObj as Progress.Json.ObjectModel.JsonObject no-undo.
oJObj = new Progress.Json.ObjectModel.JsonObject().
oJObj:Add('date',pcS).
return oJObj:GetDatetimeTZ('date').
Robin
Nice!
-- peter