Home General
New Blog Posts: Merging Reports - Part 1 and Part 2

Shortdate format

edited March 2003 in General
How do we get dates to display using the clients short date format?
Thanks,
Jon

Comments

  • edited March 2003
    The Short Date format is retrieved using Delphi calls which get the client
    machine's local Short Date format. If you would like to customize the
    display formats provided, check out the ppDisplayFormat.pas file in the
    RBuilder Source. An example of replacing a display format with one of your
    own can be found by clicking on the link below.

    http://www.digital-metaphors.com/tips/ReplaceDisplayFormats.zip

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2003
    "Nico Cizik (Digital Metaphors)" wrote in
  • edited March 2003
    Jon,

    I added the two lines of code below into the ReplaceDisplayFormats example
    and it seemed to work fine. I ran the project, entered the designer and
    added a date system variable to the header band of the report. Next I
    changed the display format to the newly added "Short Date" which matched my
    Regional Settings in Windows. After that I closed the application, changed
    the Regional ShortDate settings, then re-ran the example. The ShortDate
    display format showed the newly added Windows ShortDate setting. Add
    breakpoints where your adding the format list and in the case statement of
    the myDisplayFormat class to make sure it is trying to fomat the dtDate type
    and not the dtDateTime type.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2003

  • edited March 2003
    Jon,

    After further research, I found that you shouldn't need to create a
    customdate format because by default, ReportBuilder uses the Short Date
    format in Windows. When creating your template, make sure there is no
    display format set for the system variable when you save. This will cause
    the display format to automatically default to the Windows Short Date format
    and will change according to the specific computer's settings. If you then
    in turn want to set a custom display for the end-user, you will need to use
    the Report.Template.OnLoadEnd event to change the display format of the
    component.

    The replaceable display formats are intended to be used to provide
    non-standard display formats and they are saved in the template so you were
    seeing the intended behavior.

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2003
    "Nico Cizik (Digital Metaphors)" wrote in
  • edited March 2003
    Jon,

    I adjusted the demo I had you dowload earlier to work the way you need it
    to. Now you are able to select the 'short date' format and save the
    template, then the format will reflect another computer's setup when they
    load the template with DateTime or just Date. The display format saved in
    the template is the actual 'Short Date' string. New code in the format
    routine of the demo handles this case. You can download the updated demo
    at...

    http://www.digital-metaphors.com/tips/ReplaceDisplayFormats2.zip

    --
    Best Regards,

    Nico Cizik
    Digital Metaphors
    http://www.digital-metaphors.com
  • edited March 2003
    Nico,
    It works - Thanks!
    Jonathan
This discussion has been closed.