function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
NewToSFNewToSF 

Convert datetime to ticks

Hi,
 
 How do I convert datetime to ticks in apex?
 
Thanks.
Ron HessRon Hess
Yes, you can call getTime

getTime  LongReturns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this DateTime object

so:
  long ticks = somedatetime.getTime();