Ask Your Question

Automatically update date difference in Writer

asked 2017-04-14 15:08:30 +0100

Jack Taylor gravatar image

updated 2017-04-14 15:14:30 +0100

I'm currently writing a CV using LibreOffice Writer, and in one section I include the number of years that I have been using various programming languages. I would like these numbers to be updated automatically so that I don't have to do the date calculations in my head every time I update my CV in the future.

For example, my CV currently contains the text "JavaScript: 2 years". If I edit the file again this time next year, I would like it to automatically update to "JavaScript: 3 years".

This is possible in LibreOffice Calc using e.g. DATEDIF, but I haven't been able to make this work in Writer. Is there a way?

edit retag flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted

answered 2017-04-14 18:04:32 +0100

Regina gravatar image

Wouldn't it be easier to write "Since ..."?

You cannot use any of the Calc functions in Writer and even the few functions possible in a Writer-Table have their own definitions, different from Calc.

The only way to get the actual date in Writer, is the field variable "Date" (available from tab "Document" in "More Fields.."). But even with its "Offset in days" you get a date and not an amount of days, months or years. The only way to get what you wish, would be to write a macro.

edit flag offensive delete link more


Writing "since YYYY" is unfortunately not an option - it has to be the number of years. Writing a macro does sound like the right way to do it, although I don't know if I want to expend the effort to learn how to do it right now.

Jack Taylor gravatar imageJack Taylor ( 2017-04-15 03:28:13 +0100 )edit

answered 2017-04-14 21:14:08 +0100

karolus gravatar image

updated 2017-04-14 21:16:19 +0100

Additional to @Regina :
Maybe you can fake such Date-field with an Offset for Example -5000
and formatted to show only last 2 digits of Year

edit flag offensive delete link more


That was my first thought too and I have tried it, but you end up with 02 instead of 2.

Regina gravatar imageRegina ( 2017-04-15 00:56:46 +0100 )edit

I sort-of managed to make it work using the "E" format code (number of the year within a Japanese era), which doesn't have a leading zero. Unfortunately this will break when the era changes, which is whenever Japan has a new emperor, so it won't work long-term.

Jack Taylor gravatar imageJack Taylor ( 2017-04-15 03:21:34 +0100 )edit
Login/Signup to Answer

Question Tools

1 follower


Asked: 2017-04-14 15:08:30 +0100

Seen: 65 times

Last updated: Apr 14 '17