package ua.com.fielden.platform.equery;

public enum HqlDateFunctions {

    DAY {
	@Override
	public String toString() {
	    return "Day";
	}

	@Override
	public String getActualExpression(final String actualProperty) {
	    return YEAR.name() + "([" + actualProperty + "]) * 10000 + " + //
		    MONTH.name() + "([" + actualProperty + "]) * 100 + " + name() + "([" + actualProperty + "])";
	}
    },
    MONTH {
	@Override
	public String toString() {
	    return "Month";
	}

	@Override
	public String getActualExpression(final String actualProperty) {
	    return YEAR.name() + "([" + actualProperty + "]) * 100 + " + name() + "([" + actualProperty + "])";
	}
    },
    YEAR {
	@Override
	public String toString() {
	    return "Year";
	}

	@Override
	public String getActualExpression(final String actualProperty) {
	    return name() + "([" + actualProperty + "])";
	}
    };

    public abstract String getActualExpression(String actualProperty);
}

@@ -207,32 +207,292 @@
 tualProperty) %7B%0A
+%09    return %22cast(EXTRACT(%22 + YEAR.name() + %22 FROM %22 + %22%5B%22 + actualProperty + %22%5D) * 10000 + %22 + //%0A%09    %22EXTRACT(%22 + MONTH.name() + %22 FROM %22 + %22%5B%22 + actualProperty + %22%5D) * 100 + %22 + %22EXTRACT(%22 + name() + %22 FROM %22 + %22%5B%22 + actualProperty + %22%5D) as int)%22;%0A%0A%09    //
 %09    return YEAR
@@ -547,16 +547,22 @@
 %22 + //%0A%09
+    //
 %09    MON
@@ -807,32 +807,211 @@
 tualProperty) %7B%0A
+%09    return %22cast(EXTRACT(%22 + YEAR.name() + %22 FROM %22 + %22%5B%22 + actualProperty + %22%5D) * 100 + %22 + //%0A%09    %22EXTRACT(%22 + name() + %22 FROM %22 + %22%5B%22 + actualProperty + %22%5D) as int)%22;%0A%09    //
 %09    return YEAR
@@ -1252,32 +1252,126 @@
 tualProperty) %7B%0A
+%09    return %22cast(EXTRACT(%22 + name() + %22 FROM %22 + %22%5B%22 + actualProperty + %22%5D) as int)%22;%0A%09    //
 %09    return name

Provided date function implementation for PostgreSQL RDBMS