Dataport and date formats...

philippegirodphilippegirod Member Posts: 190
edited 2004-01-27 in NAV Tips & Tricks
In a dataport to export to a MySql format the next code in the OnAfterFormatField trigger allow convert the date in the right format :

Text := STRSUBSTNO('%3-%2-%1',COPYSTR(Text,9,2),COPYSTR(Text,6,2),COPYSTR(Text,1,4));

To import from a MySQL format use the code in the OnBefoirEvaluateField :


IF Text = '2000-00-00' THEN Text := ''
ELSE IF Text = '0000-00-00' THEN Text := ''
ELSE IF Text = '' THEN Text := ''
ELSE Text := STRSUBSTNO('%1/%2/%3',COPYSTR(Text,9,2),COPYSTR(Text,6,2),COPYSTR(Text,1,4));

Don't forget to use the Ansi2Ascii converter (available in the download section).
My candle burns by both ends, it will not last the night,
But oh my foes and oh my friends, it gives a lovely light
Sign In or Register to comment.