REST service for getServerTimestamp

How do i know the server timestamp using the salesforce REST services ?
Simialr to SOAP getServerTimestamp service, do we have any REST service ?


There is no such REST API available out of box for the same i guess .I had to implement my own custom REST API class for the same as below


 global with sharing class GetCurrentServerDateTime {

global class ResponseWrapper{
    public String currentServerTime;

global static ResponseWrapper returnCurrentServerTime(){    

    String dateInFormat = newDate.formatGMT('yyyy-MM-dd HH:mm:ss');
    ResponseWrapper resWrap=new ResponseWrapper();

    system.debug('Server time being sent:'+dateInFormat);
    return resWrap;

The urI would be /services/apexrest/currentservertime

Source : Link , Question Author : Azee Md , Answer Author : Mohith Shrivastava

Leave a Comment