Question Date Format

Raj2010

New Member
Hi there,

i have a line in my code like this : message string(article.Date) view-as alert-box information.

The message shows : 01/15/2014 ( that is mm/dd/yyyy)

I want to have this format : 01-15-2014 ( Can I change format in Parameter file so that it will reflect in all the reports?)

Could any one please let me know if any option where I can modify parameter file to change date format Please??

Thanxs !!!

Raj
 
You can't. AFAIK there is no paramter that controls the date separator. The separator is defined in the format phrase of the field/variable. But when you use the date field like that in a message statement it will automatically be converted into a string always using / as separator.

You can try:
Code:
define variable dummy as date no-undo format "99-99-9999" initial today.
message dummy skip string ( dummy, "99-99-9999" ) view-as alert-box.

Heavy Regards, RealHeavyDude.
 
Or optionally you can do this:

Code:
message replace(string(article.Date),"/","-")  view-as alert-box information.
 
It's actually the format that is ignored - use '99/99/9999' as format and the date will still be shown as '99/99/99' - which is where the replace 'option' trips over itself too.

Alternatively, (just found this in the docs - and really, you do not want to do this):

Code:
define variable dummy as date no-undo format "99-99-9999" initial today.

message 
   "today is"
   update dummy 
   .

And then cross your fingers that the user does not actually change the date. ;-)
 
Stefan,

The replace method does work for date display with dashes as in the message view-as as I posted above (at least it does for me on 10.2B Linux). To try and update on the other hand is a different animal and I agree that the ABL does not handle alternate formats for the var defined as date without some mucking about.
 
Code:
def var dt as date initial today.

message
   string( dt, "99-99-9999" ) skip
   replace( string( dt ), "/", "-" )
view-as alert-box.

returns (on windows and linux):

Code:
---------------------------
Message
---------------------------
11-17-2014 
11-17-14
---------------------------
OK  
---------------------------

14 <> 2014
 
Back
Top