You need to sign in to do that
Don't have an account?
ramk
how to convert date time value into seconds in salesforce
Hi
i have a date time value Datetime dt = DateTime.parse( '10/14/2011 11:46 AM');
now can i convert this into total seconds for that date value???
Hi,
You can make use of getTime() method of DateTime.
getTime() - Returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by this DateTime object.
DateTime dt = System.Now();
Long i = dt.getTime();
System.debug('i=====>'+i);
After receivinng milliseconds value, you can convert that value into seconds.
Thanks,
Devendra
hey,
i think you should change the format and use a formula to change current time into seconds.
hope this thing works
Cheers
Abhi
Hi,
You have created the datetime, you can extract hrs, minute, from it and multiply with respective seconds. Sum them up you will get total seconds.
Ex : 11:30 AM
11*3600=39600
30*60=1800
DateTime class has methods to extract minutes and hrs.
Regards