# AG\_DATETIME _Reviewed and revised December 2023_ **tab(-10, AG\_DATETIME); chr(127);** [Tab(-10,x) Syntax Notes](ag_xxx_syntax-notes.md) AG\_DATETIME (64) queries the system date and time according to the Windows or ATE client. **Parameters** None **Response** A comma delimited list in the form of _date, time, status_ CR where _date_ is the decimal value of the separated date format (see IDTIM[xs](keyword-types.md) for details), _time_ is the number of seconds since midnight, and _status_ will be 0 if the operation was successful else a Windows error code. **Example 1** map1 today,b,4 map1 now,b,4 map1 status,f ? tab(-10,AG\_DATETIME);chr(127); input "",today,now,status \! e.g. "108725004,40891,0" You might then compare this information against the values returned by the DATE and TIME system functions on the server to decide whether the client is reasonably in sync, and if not, you might prompt the client to update the clock on either the server or the client. **Example 2** The following illustrates AG\_DATETIME being called via the [MX\_AGWRAPPER](mx_agwrapper.md)[xs](keyword-types.md) function, which eliminates the need for a separate INPUT statement to retrieve the results. The result string contains three comma-delimited fields which we split out using a utility function [Fn'Explode() in SOSLIB:\[907,10\]](https://bitbucket.org/microsabio/soslib/src/master/907010/fnexplode.bsi), although you could use other methods, such as [INSTR()](instr().md) or [Whole Array Assignment](whole-array-assignment.md). \++include ashinc:ashell.def \++include sosfunc:fnexplode.bsi map1 misc map2 response\$,s,100 map2 fields,i,2 map2 today,b,4 map2 clocktime,b,4 map2 status,i,4 ? "Querying PC for time ..." xcall MIAMEX, MX\_AGWRAPPER, AG\_DATETIME, "", response\$ ? "Response: ";response\$ \! should be sysdate,systime,status \! split out the fields and convert to human readable format... fields = Fn'ExplodeEx(response\$,",",0,today,clocktime,status) if fields >= 3 and status = 0 then ? ODTIM(today,clocktime,0) else ? "Error" endif end