6

I'm trying to add the current date into a label for use in a composer for colleagues to run on a daily basis. The label is currently;

Bins to be delivered: [% "Count" %]

All I need to add is the current date, but when I make the label this;

Bins to be delivered: [% "Count" %] as at $now()

nothing happens.

Do I need to enter something in the 2 end brackets to bring the date in? Or is it something else I need to do?

8

Just tried it out, for me (QGis 2.18) format_date(now(),'dd.MM.yyyy') works.

/edit: You need to put the [% %] around your whole expression, then it should work, like: [%'Datum: ' || format_date(now(),'dd.MM.yyyy')%]

Note the pipes (||) between the parts of the expression, they are necessary.

/edit2: now() gives you the full date, incl. time, which is a bit much, isn't it?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.