Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options questions only not deleted user 4888

A value that indicates a particular day and time, such as a timestamp.

16 votes
2 answers
28k views

How is a DateTime object formatted into a String suitable for a String based SOQL query?

In order to write a where clause against a datetime field, you need to format your dateTime object into the following format: WHERE SystemModstamp > 2005-10-08T01:02:03Z How do you correctly convert … the dateTime object to a String? …
11 votes
1 answer
946 views

It appears that > behaves like >= in a soql query. Why?

When you format a string it automatically converts the datetime to the timezone of the SF instance. (In my case PST). … It could have been that in the process of debugging my code i switched from from bound datetime values in my soql query to string datetime values, and in so doing created the issue I was experiencing. …
7 votes
2 answers
4k views

JSON.serialize is mucking with my datetime objects. How do I fix this?

I feel that the following assertion should be true, but it is not: DateTime testDate = DateTime.now(); System.assertEquals('"' + testDate.format('yyyy-MM-dd\'T\'hh:mm:ss.SSS\'Z\'' + '"'), JSON.serialize … 28.966 (2966802000)|FATAL_ERROR|System.AssertException: Assertion Failed: Expected: "2014-04-03T04:38:27.988Z", Actual: "2014-04-03T20:38:27.988Z" Update: when using formatGMT I still get the error: DateTime
5 votes
2 answers
858 views

Is there a way to set SystemModstamp on a newly created SObject in a unit test?

I really just need to be able to modify a DateTime field on a SObject. Ideally though, I would be able to set the SystemModstamp or cause it to be set. …