SOQL Datetime literal in javascript for current Datetime.

Sometimes we need to use AJAX toolkit to do some SOQL/DML on Data from a custom button, which executes javascript. Here in this post we will just get current Datetime and then we will create datetime literal as per SOQL standard to fetch some records as per requirement.

For more information about SOQL date/datetime formats Click Here.

Where to Use :

This can be used when you need to fetch records where some datetime field is less/greater than current time. You can also update it to get records of last 1 hours, 2 hours etc.

Datetime Literal Javascript Methods :

Use With Ajax toolkit Salesforce :

Hope this will help when you are creating SOQL query string using javascript.

Use it wherever you can whether its javascript button, lightening component or anything, to save your time and be a speedy coder.

4 thoughts on “SOQL Datetime literal in javascript for current Datetime.”

  1. I think that is among the so much important information for me.
    And i am satisfied studying your article. But should observation on few common issues, The site style is
    wonderful, the articles is actually great : D. Just right task, cheers

  2. great post, very informative. I ponder why the opposite specialists of this sector do not realize this. You must proceed your writing. I am confident, you have a huge readers’ base already!

Leave a Reply

Your email address will not be published. Required fields are marked *