getServerTime

The getServerTime operation in SOAP web services takes no arguments and returns the NetSuite server time in GMT, regardless of a user's time zone. Developers do not have to rely on client time when writing synchronization procedures because the client time may not be in synch with the NetSuite server time.

SOAP Request

The following Java code sample shows how to send a getServerTime request.

            public void testGetServerTime() throws Exception
{
   c.login();

   GetServerTimeResult rs = c.getPort().getServerTime();
   System.out.println("Welcome to NetSuite. At the sound of the tone the NetSuite time will be : " + new
   SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(rs.getServerTime().getTime()));

   System.out.println("This compares with a client time of " + new SimpleDateFormat("yyyy-MM-dd
   HH:mm:ss").format(Calendar.getInstance().getTime() ));
   System.out.println("This represents a skew of  "  + (Calendar.getInstance().getTimeInMillis()
   rs.getServerTime().getTimeInMillis() )/1000 + " seconds from netsuite
   (where positive time means the client clock is comparatively fast).");
} 

          

REST Request

In REST web services, the serverTime operation returns the NetSuite server time in UTC, regardless of a user's time zone.

The following example shows how to send a serverTime request.

            GET https://demo123.suitetalk.api.netsuite.com/services/rest/system/v1/serverTime 

          

REST Response

The following example shows that the dateTime value is returned by serverTime is in UTC time zone.

            {
    "serverTime": "2025-03-26T16:21:00.000Z"
} 

          

Related Topics

General Notices