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


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
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.
# 2  
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.
This User Gave Thanks to drysdalk For This Post:
# 3  
Try just using:
Code:
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:
Code:
date mmddHHMMYYYY

where YYYY is the year you want.
# 4  
Problem resolved

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.
This User Gave Thanks to trolley For This Post:
# 5  
You also need to update the CMOS clock.
Code:
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
These 2 Users Gave Thanks to jgt For This Post:
# 6  
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
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
Compare date in .txt with system date and remove if it's lesser than system date
Stuti
I m working on shell scripting and I m stuck where in my .txt file there is column as expiry date and I need to compare that date with system date and need to remove all the rows where expiry date is less than system date and create a new .txt with update.... Answers to Frequently Asked Questions
1
Answers to Frequently Asked Questions
Compare date in .txt with system date and remove if it's lesser than system date
Stuti
Can someone help me with the code wherein there is a file f1.txt with different column and 34 column have expiry date and I need to get that and compare with system date and if expiry date is <system date remove those rows and other rows should be moved to new file f2.txt . I don't want to delete...... UNIX for Beginners Questions & Answers
2
UNIX for Beginners Questions & Answers
Date: invalid date trying to set Linux date in specific format
umen
i try to set linux date & time in specific format but it keep giving me error Example : date "+%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01" or date +"%d-%m-%C%y %H:%M:%S" -d "19-01-2017 00:05:01" keep giving me this error : date: invalid date 19-01-2017 00:05:01 Please use CODE tags...... Shell Programming and Scripting
7
Shell Programming and Scripting
Set system date to some date (Sunos)
hanton
I am testing a script and need to change the system date to Nov 30 2009. I cannot seem to find a way to do this other than TZ command but it does not seem to work correctly. I tried TZ=GMT+168 date but it is returning todays date Mon Dec 7 19:48:11 GMT 2009 ...instead of Nov 30 2009 I...... Shell Programming and Scripting
4
Shell Programming and Scripting
Alternatives to set the system date ??
ulisses0205
Hi all, I need to syncronize a Solaris client with a QNX Server, modifying the client date, I need any alternative to set the sistem date (client Solaris) but i can't use commands date -a XXX (XXX are the time in seconds) and can't use rdate and ntp. How can I do It? :confused:... UNIX for Advanced & Expert Users
2
UNIX for Advanced & Expert Users

Featured Tech Videos