Date Format

I have an user variable, value is set as '2010-01-20'. I try to display it on a text object with a date format as "dd mmm yyyy". It won't follow the format and just display "2010-01-20" instead. How do I convert it? Thank you in advance!

Comments

  • gordkgordk St.Catherines On. Canada.
    edited 1:49PM
    use the string to date function
  • edited 1:49PM
    Thank you very much! I tried the following and it works. I think fastreport just follow the date style, such as 'dd/mm/yy', from Windows settings. If I set the variable string to '2010-01-01', then it will cause an error. Is that possible to let fastreport follow a style of 'yyyy-mm-dd' and while the Windows settings is 'dd/mm/yy'.

    [StrToDate(<startday>)]
    gordk wrote: »
    use the string to date function
  • gpigpi
    edited 1:49PM
    Use
    [EncodeDate(StrToInt(Copy(<startday>, 1, 4)), StrToInt(Copy(<startday>, 6, 2)), StrToInt(Copy(<startday>, 9, 2)))]
  • edited 1:49PM
    Thank you gpi, it works perfect! By testing the date format, I found something very interesting which is the query for report. The variables of startday and endday are provided for query's >1 andyy", the query still works fine. Don't know whether fastreport change it or postgreSQL ODBC driver change it?
  • edited 1:49PM
    Sorry! It's ":p1" and ":p2".

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.