New answers tagged


I may assume, that you need DateTime, not Date, because you have hours and minutes specified. Datetime.valueOf() works for format yyyy-MM-dd HH:mm:ss, so you need to replace T with space and remove Z. String toConvert = '2021-06-15T02:30:00.000Z'; toConvert = toConvert.replace('T', ' ').replace('Z', ''); Datetime actualDatetime = Datetime.valueOf(...


Here you can convert this using Date static class. System.debug(Date.valueOf('2021-06-15T02:30:00.000Z'));


The below code will give you difference between two dates in days. You can divide the final result by 30 then you will get it in months.;//get it from onchange;//get it from onchange var date1=new Date(this.startDate); var date2=new Date(this.endDate); var dateDiff=(date2.getTime()-date1....


.hour() and .date() functions show time in user local time zone already, so you do not need to add offset to now variable. now =; hourNow = now.hour(); todayDate =;

Top 50 recent answers are included