[ntp:questions] Re: how to question: query an ntp server to return the date

lb noone at nowhere.com
Thu Jan 27 03:04:04 UTC 2005

thx for the reply.
the problem is that the machine runs some old accounting package and
the date actually needs to be changed back in time to do certain
functions. stupid it is. but somehow i need to get the true date in
order to run some backup and maintenance processes. 
any ideas on a way to do this?
thx again.

In article <CfOdnRcZMsc112XcRVn-oQ at comcast.com>, Richard B. Gilbert
<rgilbert88 at comcast.net> wrote:

> lb wrote:
> >hi. i was wondering if anyone can help me.
> >on a unix machine, i want to be able to query an ntp server and return
> >just the actual date in the form mmddyy. ntpdate -q gives too much
> >info.
> >is there an easy way to do this?
> >thx in advance,
> >-lyle
> >  
> >
> The NTP protocol was not exactly designed to do what you want and 
> neither is the ntpdate utility.  Is there some reason you can't simply 
> use "date +%m/%d/%g"?   This does require that the  Unix system's clock 
> be set more or less accurately.  If the clock is not accurate, you can 
> use ntpdate to set the clock and then date to extracted a formatted 
> date/time.  See man date and man strftime.  "date+5m/+%d/%Y" will  get 
> you mm/dd/yyyy if you want the four digit year.
> If you need the UTC date rather than the local date, you can set your 
> time zone appropriately.

More information about the questions mailing list