Operating System - HP-UX
1832605 Members
2608 Online
110043 Solutions
New Discussion

exact command to set date/time

 
SOLVED
Go to solution
Mark2010_1
Frequent Advisor

exact command to set date/time

Hello,

May anyone plz give the exact command to set the date + time for instance: actual date (18 september) and time = 19H 30min 15 sec PM.



thanks in advance.
10 REPLIES 10
whiteknight
Honored Contributor

Re: exact command to set date/time


Mark,

you can use

#set_parms date_time



WK
please assign points
Problem never ends, you must know how to fix it
Mark2010_1
Frequent Advisor

Re: exact command to set date/time

Hi whiteknight


BR
Pete Randall
Outstanding Contributor
Solution

Re: exact command to set date/time

From the man page for date:

date [-u] [mmddhhmm[[cc]yy]]

Set the HP-UX system clock to the date and time specified. You require the superuser privilege.

If you include the -u option, the specified date and time is assumed to be in Coordinated Universal Time (UTC).

The numeric argument is interpreted left to right in two-digit pairs as follows:
mm Month number [01-12].
dd Day number in the month [01-31].
hh Hour number (24-hour system) [00-23].
mm Minute number [00-59].
cc Century minus one [19-20].
yy Last two digits of the year number [70-99, 00- 7 (1970-1999, 2000-2037)]. If omitted, the current year is used.


Pete

Pete
Mark2010_1
Frequent Advisor

Re: exact command to set date/time

Hi Pete,

I tried this but I am sure I am miss understanding the arguments: Can tell me the exact syntax please for setting:

actual date (18 september) and time = 19H 30min 15 sec PM.
V. Nyga
Honored Contributor

Re: exact command to set date/time

Hi,

'date 09181930'

seconds are not possible - see 'man date'

Volkmar
*** Say 'Thanks' with Kudos ***
James R. Ferguson
Acclaimed Contributor

Re: exact command to set date/time

Hi:

> Can tell me the exact syntax please for setting: actual date (18 september) and time = 19H 30min 15 sec PM.

There is NO seconds field to the argument. The manpages for 'date' is quite clear:

date [-u] [mmddhhmm[[cc]yy]]

Assuming what you provided was your localtime:

# date 09181930

The optional switch '-u' means UTC (GMT); The optional century (20) and year (07) need not be given.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: exact command to set date/time

>I tried this but I am sure I am miss understanding the arguments:

Is your problem the seconds as Volkmar mentioned?
Otherwise you need to explain why you can't understand what Pete said.
Mark2010_1
Frequent Advisor

Re: exact command to set date/time

Yup, it is the seconds.
V. Nyga
Honored Contributor

Re: exact command to set date/time

so you've to start your command 15 seconds before you want to ;-))
*** Say 'Thanks' with Kudos ***
Dennis Handly
Acclaimed Contributor

Re: exact command to set date/time

You can of course use sleep to get it closer:
sleep 45; date 09181931