possible bug espocrm 6.0.3 formula datetime\format and datetime\year

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    possible bug espocrm 6.0.3 formula datetime\format and datetime\year

    I have one date field with datetime\now() named year (this works).
    From this field I want to extract only the year into another date field named invoiceYear with this formula: invoiceYear=datetime\format(year, 'YYYY');

    There will be no result, the field invoiceYear stays empty.

    The log:
    Code:
    [2020-11-02 12:37:40] Espo.ERROR: Formula failed: DateTimeZone::__construct(): Unknown or bad timezone (YYYY) [] []
    [2020-11-02 12:38:56] Espo.ERROR: (22007) SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '02.11.2020 13:38' for column 'rechnungsjahr' at row 1; POST /Rechnung/action/massRecalculateFormula; line: 72, file: G:\laragon\www\Werkverzeichnis\application\Espo\OR M\SqlExecutor.php [] []
    [2020-11-02 12:40:21] Espo.ERROR: (22007) SQLSTATE[22007]: Invalid datetime format: 1292 Incorrect datetime value: '2020' for column 'rechnungsjahr' at row 1; POST /Rechnung/action/massRecalculateFormula; line: 72, file: G:\laragon\www\Werkverzeichnis\application\Espo\OR M\SqlExecutor.php [] []
  • shalmaxb
    Senior Member
    • Mar 2015
    • 1602

    #2
    OK it is not a bug. What is not made clear in the documentation is, that the receiving field (the mentioned invoiceYear) must not be a date field, it has to be a varchar field.

    Comment


    • yuri
      yuri commented
      Editing a comment
      No. There's no date or varchar fields in formula. Only string is accepted. Date field in EspoCRM is actually a string.
Working...