"Result of date type attributes in Write Excel operator"

qwertzqwertz MemberPosts:130Maven
edited June 2019 inHelp

Dear all,

I was wondering about the result of the "write excel" operator. When feeding dates (without time) into it the excel file contains the same date (not surprising so far) but with an additional time which seems to vary randomly all over the day.

??? ??? ???





<宏/ >














Sincerely
Sachs
Tagged:

Answers

  • Nils_WoehlerNils_Woehler MemberPosts:463Maven
    Hi,

    the reason here is that the Generate Sales Data produces random timestamps that are only displayed as date.
    If you write them to excel you see the exact date.

    Best,
    Nils
  • qwertzqwertz MemberPosts:130Maven

    I tried another setup:

    - Manually create an excel sheet with dates (without time resp. hours)
    - Read this sheet with "read excel" operator
    - Write back this sheet with "write excel" operator

    Result was the same. Excel shows date + time though time has never been specified.

    Example from output file:
    2006-03-05 01:00:00
    2006-04-08 02:00:00
    2006-04-10 02:00:00
    2006-05-07 02:00:00


    Cheers
    Sachs
  • Nils_WoehlerNils_Woehler MemberPosts:463Maven
    Internally all dates are stored as a Java's Date class. This format is stored as milliseconds since 1970 thus it implicitly adds time to dates from excel even if they are stored as date only.
    Furthermore the default date format for the Write Excel operator is 'yyyy-MM-dd HH:mm:ss'.
    Due to this two facts you see a time in the resulting excel file even if you haven't specified one before.

    Best,
    Nils

  • qwertzqwertz MemberPosts:130Maven

    Hi Nils,

    thanks for letting me know. I now have a better understanding, why time appears in excel.

    However, I'm still wondering that hours vary (e.g. "01:00:00" and "02:00:00" - see example in my last post).


    Have a nice day
    Sachs
  • Nils_WoehlerNils_Woehler MemberPosts:463Maven
    This is a bug that will be fixed with the next update. Normally the time should be set to 00:00:00.

    Best,
    Nils
Sign InorRegisterto comment.