1

How to use utc_timestamp in Symfony 4?

Getting below message while using utc_timestamp

[Semantical Error] line 0, col 199 near 'UTC_TIMESTAMP': Error: 'UTC_TIMESTAMP' is not defined.

5
  • 1
    Is there any code involved that you want to share? That's not an error thrown by Symfony itself Commented Apr 10, 2019 at 12:52
  • 1
    @NicoHaase i tried this but not working This is doctirne dql query @$qb->andWhere("(pv.appointmentDate) >= UTC_TIMESTAMP"); Commented Apr 10, 2019 at 13:00
  • 1
    Please add everything that is relevant into the question, don't use the comment section for that. And: obviously, you are using any random string and not a function in your code. Have a look at github.com/beberlei/DoctrineExtensions Commented Apr 10, 2019 at 13:03
  • @NicoHaase i want to use like this: stackoverflow.com/questions/55624934/… Commented Apr 11, 2019 at 4:53
  • You're welcome to do so, but you have to do something for it. It won't work out of the box Commented Apr 11, 2019 at 7:08

2 Answers 2

1

I think you need to use utc_timestamp with doctrine. you can include library in doctrine.yaml file.

orm:
        dql:
            string_functions:
                UTC_TIMESTAMP: DoctrineExtensions\Query\Mysql\UtcTimestamp

Check with above code. Might be helpful.

Sign up to request clarification or add additional context in comments.

Comments

1

It seems there is wrong way to use it. UTC_TIMESTAMP use with parentheses. it should like:

$qb->andWhere("(pv.appointmentDate) >= UTC_TIMESTAMP()");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.