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
    Commented Oct 29, 2015 at 15:29

1 Answer 1

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. Commented Nov 3, 2015 at 12:17
  • @user3722921 - Awesome buddy, glad you got it working! And not stupid at all, it's always easy to make mistakes :)
    – Joseph
    Commented Nov 3, 2015 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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