0

I'm having the same problem from this previous question.

I keep getting some nulls after running expression. Not sure why it works on some dates

I have dates(strings) in the form 1/4/2005, 11/11/2004, etc

Here is code I used in field calculator:

btw data will be uploaded to django app using PostGeSQL

from qgis.core import *
from qgis.gui import *
from PyQt4.QtCore import QDate

@qgsfunction(args="auto", group='Python')
def parse_date_dmy(fromval, feature, parent):
    return QDate.fromString(fromval, 'dd/MM/yyyy')
  • fast guess is, that there is a difference between 1/4/2005 and 01/04/2005 – LaughU Sep 6 '17 at 14:33
  • can you say which datas work and which don't? – Ian Turton Sep 6 '17 at 14:33
  • the text i'm trying to convert is month/day/year like 1/29/2014. could i have the wrong format? I'm using dd/MM/yyyy in expression – geomajor56 Sep 6 '17 at 14:41
  • 1
    just noticed some years are yy only, not yyyy – geomajor56 Sep 6 '17 at 14:41

Your Answer

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

Browse other questions tagged or ask your own question.