q := datastore.NewQuery("Encounter").Filter("PatientID =", patientID).Order("CreatedDate").Order("-CreatedBy")
How can I query all the values except the values created today?
Add a filter by CreatedDate.
t := time.Now()
zone, _ := time.LoadLocation("Europe/Amsterdam")
day := time.Date(t.Year(), t.Month(), t.Day(), 0, 0, 0, 0, zone)
q := datastore.NewQuery("Encounter").Filter("PatientID =", patientID).Filter("CreatedDate <", day).Order("CreatedDate").Order("-CreatedBy")
This only returns items older than today. If you need both older and newer than today, since there is no inequality in filters, you can fetch older and newer than today, then iterate through them and append the results.