mmtmalone
30th May 2013, 22:30
I have an input file that I'm uploading into baan. The input file will contain a field that is supposed to be a date field in baan. I need to convert this field to a date field before adding it to baan.
The format of the date will be mm/dd/yyyy.
So it might have:
10/1/2013
10/12/2013
1/1/2013
I have tried using the inputstr.to.date but I can't seem to get it to work right.
Any other suggetions??????

mark_h
30th May 2013, 23:27
This is the correct forum for tools questions. The code and utilites forum is for code you wish to share with the community.

Look at using string.scan to break it into pieces with / as the separator. Then use date.to.num to convert to a date.

Ajesh
2nd June 2013, 13:34
If you can capture the input date into a string, You can easily use the Function

inputstr.to.date(). You can refer the Baan Programmers Guide for further Details

Syntax
long inputstr.to.date( string inputstr(.), string format(7) )

Description
This converts a date input string to the number of days since 01-01-0001.

Arguments
inputstr
The date input string, possibly input by the user and retrieved using the function data.input.

format
Indicates the format of the input string, specified by using the substitution symbols %Dxxx[, lang].


Return value
The number of days from 01-01-0001 to the date specified in the input string.

-1 Error.