LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-17-2018, 06:34 PM   #1
James0806
Member
 
Registered: Jul 2014
Posts: 41

Rep: Reputation: Disabled
Changing the Linux server date to future


Hi,

I have tried changing the date of the linnux machine to past which is happening but not to the future

Code:
date -s "19 APR 2012 11:14:00"
with the above command we can set it to that date but i want it to be for the year 2019

it is just displays when i replace 2012 with 2019 and later it is to the current date and time

Last edited by James0806; 07-17-2018 at 06:36 PM.
 
Old 07-17-2018, 07:21 PM   #2
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,321
Blog Entries: 28

Rep: Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141
There's a good chance the machine is set to sync from a time server in the internet.

Whyever would you want to do this?
 
Old 07-19-2018, 10:49 AM   #3
James0806
Member
 
Registered: Jul 2014
Posts: 41

Original Poster
Rep: Reputation: Disabled
The ntp service was disabled and as said we could change the date to past date but not to the future date.
I wanted to change it to the year 2019
 
Old 07-19-2018, 11:21 AM   #4
rtmistler
Moderator
 
Registered: Mar 2011
Location: USA
Distribution: MINT Debian, Angstrom, SUSE, Ubuntu, Debian
Posts: 9,882
Blog Entries: 13

Rep: Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930Reputation: 4930
Are you saying that it just doesn't happen and you receive no error when you issue the command?

Because I do that on systems that have no real time clock nor NTP service.

You set the date. And since every date from 00:01 1/1/1900 is a future date, it just works.
 
Old 07-21-2018, 10:05 AM   #5
AwesomeMachine
LQ Guru
 
Registered: Jan 2005
Location: USA and Italy
Distribution: Debian testing/sid; OpenSuSE; Fedora; Mint
Posts: 5,524

Rep: Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015Reputation: 1015
Maybe you could try setting it in the bios.
 
Old 07-21-2018, 08:33 PM   #6
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,321
Blog Entries: 28

Rep: Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141
I think AwesomeMachine is onto something. After you set the software date, try running

Code:
hwclock -w
and let us know what happens.

From the man page for hwclock:

Quote:
-w, --systohc
Set the Hardware Clock from the System Clock, and update the timestamps in /etc/adjtime. When the --update-drift option is given, then also (re)calculate the drift factor.

Last edited by frankbell; 07-21-2018 at 08:36 PM.
 
  


Reply

Tags
date, datetimectl



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to subtract current date and future date in YYYY-MM-DD format archie7 Linux - Newbie 11 05-11-2018 03:29 AM
OS image installs with future date timestamp rockie321 Linux - Software 2 07-11-2011 02:46 AM
Perl/bash - calculate date in future rose_bud4201 Programming 6 05-10-2009 05:59 AM
How to get date in future? niner710 Linux - Newbie 5 05-10-2009 03:45 AM
files are created in the future while date cmd output is perfectly fine zvika Linux - Newbie 1 10-16-2008 11:03 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 09:26 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration