Correcting a date format

JamieBrown
JamieBrown Member Posts: 107
Hi,

I'm hoping this is a simple fix...

I need to be able to convert an incorrect date format across to UK standard.

For example:

062410 needs to be converted to 241006

Thanks in advance.

Answers

  • NR
    NR Member Posts: 78
    If you are talking about the date format displayed in Navision, then changing the Regional Date and time - Language settings to "English UK" would solve your purpose.

    If you are talking in terms of C/AL, then using the format function would help you acheive the same :
    Format(Value,0,5);
  • JamieBrown
    JamieBrown Member Posts: 107
    NR,

    sorry yes I mean C/AL. I've tried the format option you gave but it errors with: The Date Formula '061024' contains a number that is too large. The number should be in the range 0 - 9999.

    If I also apply the format to the original field (which is Text) I get the error message: Standard Format no. 5 does not exist for the type 'Text'.

    Any ideas?
  • kriki
    kriki Member, Moderator Posts: 9,127
    TheNewDate := 
      COPYSTR(TheDate,3,2) +
      COPYSTR(TheDate,1,2) +
      COPYSTR(TheDate,5,2);
    
    Regards,Alain Krikilion
    No PM,please use the forum. || May the <SOLVED>-attribute be in your title!


  • JamieBrown
    JamieBrown Member Posts: 107
    Perfect!

    Thanks