Date formatting in a report

I have an older accounting app (SBT Pro) that is using VFP 5. I don't have the source code available, but I can modify things in the report design. Currently control text box in bound to variable txt_date which displays in the report as mm/dd/yy (i.e. 07/24/06). I need it to show like mm/dd/yyyy (07/24/2006). I've tried several things, no success. How can I do this

Thanks,

Shreko



Answer this question

Date formatting in a report

  • Tzu-Yie

    I apologize for not knowing trivial things about VFP, but how do I check the status of the CENTURY variable. I have tried set('CENTURY') in the command window, but does not give me anything. Also, what are the DE methods

    Shreko


  • Shean

    Hi Shreko,
    As I understand you are working on a text field not a date field.
    No matter what you use to get full century, it won't change the value of the text field!

    Option 1. You should convert your field to date type and use the new one on your report.

    dmyDate = ctod(text_datefield)

    Option 2. In your report use this expression ctod(text_datefield)

    Vedat

  • ideal24293

    If you can use report only, use Detail Band's OnEntry method to see type of ct_date with MessageBox(Vartype(ct_date)).

    In same way you could see if Set Century is On using MessageBox(Set('Century')). If type of ct_date is 'D' (or 'T') and Century is Off, set century to ON in Report's DE methods (eg: BeforeOpenTables)...



  • Javahar

    shreko wrote:
    I apologize for not knowing trivial things about VFP, but how do I check the status of the CENTURY variable. I have tried set('CENTURY') in the command window, but does not give me anything. Also, what are the DE methods

    SET CENTURY ON in the command window won;t do much for you, especially if the report is using its own private data session.

    To see what DE method are, open a report. Right click on the report and select "Data Environement" from the context sensitive menu. Now Rich_click on the data environment window and select "Properties" from the context sensitive menu. Now click on the method tab of the property sheet. There are the DE methods.

    Sounds like you are new to VFP. Do yourself a favor and get a copy of Fundamentals: Building Visual Studio Applications on a Visual FoxPro 6.0 Foundation at http://www.hentzenwerke.com/catalog/fund6.htm. It will certainly help to get you up to speed.

    This forum will help you by answering specific questions but it will not be able to teach you the language.



  • Adi Kremer

    Is Set Century correctly setted

    You could set century in report's DE methods...



  • Kamil Janiszewski

    Thanks for your help. I have tried DE and I get only a blank window in which I can not type anything. Right click on DE gives me list of options with "properties" being disabled. This must be related to not having the source code for the application.
    Is there anything else I could do




  • Broken

    To be honest with you, I don't really know if it is text field or date. I just see control on the form bound to value "ct_date" or something like that. I would not mind experiment with different suggestions, but I don't wanna burn too many cheques. This all comes from cheques layout being changed, I was able to move control box to required spot, but our bank also requires year in 4 digits and this is what I am trying to do. Trouble is, every time I experiment with something, program uses that number and our pre printed cheques must be voided/destroyed. I wanna minimize this and that is why I am turning to you for help.

    Thanks,


  • Abara6

    Hi Shreko,
    Please use that

    if type('ct_date') = 'C' && check if the field type is character/text
    ct_date = ctod(cdDate)
    endif

  • Date formatting in a report