9.05 BAQ - Syntax to convert date to string YYYY-MM-DD format?

I am sure there is a better way, but I did this using a series of sub-strings:

Substring(String( JobHead.DueDate ,"99-99-9999"),7 ,4 ) + "-" + Substring(String( JobHead.DueDate ,"99-99-9999"),1 ,2 ) + "-" + Substring(String( JobHead.DueDate ,"99-99-9999"),4 ,2 ))



Does anybody know the syntax to convert a date field to a string field in the "yyyy-mm-dd" format?


Default is:Â String(Â [datefield] ,"99-99-9999")


I tried changing this to:Â String(Â [datefield] ,"9999-99-99") but that didn't work.


I need it in year-month-day format for proper sorting functionality.