Category: SOQL

Working with datetimes

This time I want to point out some weird behaviours I have learnt with the practice about datetimes in Salesforce. Did you know them?

1. Datetime fields do not store milliseconds.

Currently datetime fields don’t support millisecond precision. Even if you work with Datetime class (which do support millisecond precision), when you store them in database the milliseconds are lost.

This is a problem if you need to work with a high time precision, that can be worked around in some ways, for example storing the Unix time in a number field.

You can vote this related idea if you feel it is an important fact.

Continue reading “Working with datetimes”

Advertisements