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

Login or Register to Reply

Thread Tools Search this Thread
# 1  
Old 03-13-2017
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  
Old 03-13-2017

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:
rbatte1 (03-14-2017)
# 3  
Old 03-13-2017
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.
# 4  
Old 03-13-2017
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:
rbatte1 (03-14-2017)
# 5  
Old 03-13-2017
You also need to update the CMOS clock.
date -t yyyymmddhhmm; setclk -r

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:
jim mcnamara (03-14-2017) rbatte1 (03-14-2017)
# 6  
Old 03-14-2017
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.

# 7  
Old 03-14-2017
Thanks for all the responses, I am all set.
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 Answers to Frequently Asked Questions 1 1 Week Ago 06:16 AM
Compare date in .txt with system date and remove if it's lesser than system date Stuti UNIX for Beginners Questions & Answers 2 1 Week Ago 06:13 AM
Date: invalid date trying to set Linux date in specific format umen Shell Programming and Scripting 7 4 Weeks Ago 03:19 AM
[Solved] How to tar data along with current system date and time.? manalisharmabe Shell Programming and Scripting 10 01-31-2013 05:14 PM
Adding hours and minutes to current date (Only to date not to time) manojgarg UNIX for Dummies Questions & Answers 4 08-22-2012 11:50 AM
Is there any way to set the files modified date and stamp to last modifies time? saluja.deepak Emergency UNIX and Linux Support 7 08-08-2011 10:58 AM
append a filename with system date and time amsn08 Shell Programming and Scripting 1 07-30-2011 12:34 PM
Delete a row from a file if one column containing a date is greater than the current system date chumsky UNIX for Dummies Questions & Answers 4 07-06-2011 03:07 AM
Shell Scripts - shows today’s date and time in a better format than ‘date’ (Uses positional paramete citizencro UNIX for Dummies Questions & Answers 3 04-11-2011 10:03 PM
Set date and time stamp of one file to another prvnrk Shell Programming and Scripting 2 12-31-2010 09:57 AM
Set system date to some date (Sunos) hanton Shell Programming and Scripting 4 12-08-2009 06:18 PM
Date comparison with 'string date having slashes and time zone' in Bash only TariqYousaf Homework & Coursework Questions 1 10-08-2009 02:27 PM
Date comparison in file to system time zainravi Shell Programming and Scripting 3 03-06-2009 03:48 AM
Compare date from db2 table to yesterday's Unix system date sasaliasim Shell Programming and Scripting 9 12-01-2008 11:37 PM
Alternatives to set the system date ?? ulisses0205 UNIX for Advanced & Expert Users 2 04-07-2004 05:43 AM