Skip to content
Advertisement

How can I get the current time in Azure DocumentDB

I’m looking for the equivalent of MySQL now(). Any format is fine.

Advertisement

Answer

This User Defined Function (UDF) should do the trick.

function now() {
    return new Date();
}

You would call it like this:

SELECT udf.now(), c.date, c.id FROM c WHERE c.date < udf.now()
User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement