Its probably a good idea to give some context to your question, as it was probably not many people saw the relation to Generico in that.
I attached a template that uses the code you posted to fetch the quiz timeopen value and display it. Use this in the quizzes description area.
Note that its a bit tricky getting the dataset value in javascript, so I added an arbitrary "id" value (0) to be retrieved via sql. And also note that I passed in the @@moodlepageid@@ variable to the sql, so the Generico template will only work when posted in the quizzes description area. But you could hardcode/replace that with the quizzes cmid or create a regular variable for the teacher to specify the cmid, and pass that it in to SQL.