Cannot use 'date -t' to set the system date and time

Hi! All,

I am trying to reset the date and time since the change in time over the weekend. I cannot issue the command date -t 201703131330 .
The system gives me an error invalid option.

This happens on my SCO OpenServer 5.0.7 and 5.0.6. Do anyone have an idea why? I even tried using scoadmin system time . I got the same error.

Hi,

Now, disclaimer: I'm about as far from an expert in SCO UNIX as it's possible to be. But from some Googlings it seems your syntax is correct for the implementation of date in your version of SCO UNIX.

So, shot in the dark guess here: do you have another version of the date command (GNU date, say ?) in your PATH before the native SCO one ? That might explain why even the SCO admin tools are failing with the same error, if the date command they're picking up on isn't the SCO one, and so the -t flag is being rejected.

As I say, a pure guess, but it's the best thing I can think of: that the date command you're running isn't actually the native SCO one.

1 Like

Try just using:

date mmddHHMM

(no option and no leading + sign) where mm is the month you want, dd is the day you want, HH is the hour (in two digit 24 hour format), and MM is the minute you want.

If you also need to change the year from the year that your system clock is currently displaying, add the year to the time you set using:

date mmddHHMMYYYY

where YYYY is the year you want.

Hi! All,

Thanks for the response. The problem was indeed the path, /usr/gnu/bin was before /bin . Once I made the switch in the admin profile, it worked just fine.

1 Like

You also need to update the CMOS clock.

date -t yyyymmddhhmm; setclk -r

and:
What is the UDK Compatibility Module Update version 8.0.2Ca for OpenServer 5.0.7?
I don't think there is anything you can do for 5.0.6

2 Likes

Could it also be (given that you don't show any errors) that the timezone gets in the way? The real time is stored in UTC/ZULU/CUT/GMT and it is compensated for by the timezone setting in $TZ before it is displayed.

Is it that the time is set okay, but when you display it there is a discrepancy because of your timezone?

Of course, NTP might be getting in and re-setting the clock too. Typically this is done at boot time as a big step.

Robin

Thanks for all the responses, I am all set.