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')
4
  • fast guess is, that there is a difference between 1/4/2005 and 01/04/2005
    – LaughU
    Commented Sep 6, 2017 at 14:33
  • can you say which datas work and which don't?
    – Ian Turton
    Commented Sep 6, 2017 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
    Commented Sep 6, 2017 at 14:41
  • 1
    just noticed some years are yy only, not yyyy
    – geomajor56
    Commented Sep 6, 2017 at 14:41

0

Your Answer

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

Browse other questions tagged or ask your own question.