3

I am trying to edit an existing date field of the form "yyyy/mm" to a format that the TimeManager Plugin for QGIS can handle - I guess "yyyy/mm/dd" will do it.

I've got as far as opening the attribute field table, adding a new table and getting the field calculator up - but I can't see how to simply add a "/01" to the existing info in the field without getting a "invalid expression" error.

1
  • 1
    can you screenshot how you are putting the expression in the field calculator so we can see the syntax – ed.hank Oct 29 '15 at 15:29
3

In the Field Calculator, create a new String field and use the name of the date field as the expression:

"Date_field"

Next, check the Update existing field option and select the "Date_field". Then use this expression to copy the values from the string field with the added /01:

"String_field" + '/01'

Hope that helps!

2
  • 1
    Thanks - that did it - I was stupidly including a '=' before the statement. – user3722921 Nov 3 '15 at 12:17
  • @user3722921 - Awesome buddy, glad you got it working! And not stupid at all, it's always easy to make mistakes :) – Joseph Nov 3 '15 at 12:23

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.