Date& Time change in linux beyond few days back


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Date& Time change in linux beyond few days back
# 1  
Old 09-29-2008
Hammer & Screwdriver Date& Time change in linux beyond few days back

Hi,

Could you please let me know the command to change my date /time beyond few days back. Currently when i am trying the below commands able to go beyond one day at max.

-->date
-->Mon Sep 29 19:31:58 EST 2008
-->export TZ=TMP40:00:00 (Changing the date beyond 40 hours)
-->Sun Sep 28 09:32:24 TMP 2008 (date changed back upto 34 Hours, even though i mentioned above as 40 hours)
-->export TZ=TMP90:00:00 (Changing the date beyond 90 hours)
-->Sun Sep 28 09:32:42 TMP 2008 (date changed back upto 34 Hours, even though i mentioned above as 90 hours).

So looking for date change command in linux (Linux melrhtest4.nmh-au 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:14 EST 2007 x86_64).

Thanks.
# 2  
Old 09-29-2008
Use date -s <new date & time> or date -u <UTC new date & time>
You must be logged on as root. This permanently changes the date/time.
# 3  
Old 09-29-2008
Hi u can use this below perl

Code:
perl -e'@x=localtime time-86400;printf"%4d%02d%02d\n",$x[5]+1900,$x[4]+1,$x[3]'

change this value 86400 according millsec
# 4  
Old 09-30-2008
Quote:
Originally Posted by komala
Hi,

Could you please let me know the command to change my date /time beyond few days back. Currently when i am trying the below commands able to go beyond one day at max.

-->date
-->Mon Sep 29 19:31:58 EST 2008
-->export TZ=TMP40:00:00 (Changing the date beyond 40 hours)
-->Sun Sep 28 09:32:24 TMP 2008 (date changed back upto 34 Hours, even though i mentioned above as 40 hours)
-->export TZ=TMP90:00:00 (Changing the date beyond 90 hours)
-->Sun Sep 28 09:32:42 TMP 2008 (date changed back upto 34 Hours, even though i mentioned above as 90 hours).

So looking for date change command in linux (Linux melrhtest4.nmh-au 2.6.18-8.el5 #1 SMP Fri Jan 26 14:15:14 EST 2007 x86_64).

Thanks.
Be careful when taking time backwards on UNIX servers. The timestamps are all absolute for the beginning of the epoch (number of seconds since 1970).

the system can get into a mess by doign this because it can take a look at a file and find that it has now been created in the future!

Why do you need to wind the clock back? - unless, of course, it is to bypass licensing issues?
# 5  
Old 09-30-2008
Hi,
I am looking for date change temporarely in a session alone.
When is use TZ=TMP+140 in sunsolaris it was working and able to go back beyond five days, where as same is not working in Linux.
At max i can go beyond 34 hours in Linux.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Linux froze and got back working 5 days later, no reboot.

Hello my friends, I've come across the weirdest of glitches. I'm running a simple weather monitor (just temperature) on a Raspbeery Pi 3B (Raspbian Linux 4.14.98-v7+). It has a 3G modem that sends out simple packets to my server at home. On june 5th I lost remote access to the device.... (1 Reply)
Discussion started by: OmahaWiz
1 Replies

2. Shell Programming and Scripting

Script to change date/time

Hi everybody! I need to perform a task with a script but I have no idea how to do it, I hope someone could help me: - on my linux pc I have many folders with movies, tv shows, toons, ecc. They are shared by a dlna server to my panasonic tv where I can browse and see them. The problem is that... (6 Replies)
Discussion started by: Torquemada
6 Replies

3. Shell Programming and Scripting

Date Time Change for a particular target Zone

Hi Summary: - Script will take 2 arguments - Argument 1: Date/Time value in a particular format - Argument 2: TimeZone value Examples: Argument 1: a. "May 11, 2012 08:00:00 AM" b. "Dec 21, 2012 12:21:12 PM" c. "Oct 2, 2012 05:00:00 PM" Argument 2: a. MT or MST or MDT b. ET c.... (4 Replies)
Discussion started by: anuragpgtgerman
4 Replies

4. UNIX for Dummies Questions & Answers

Which Unix & Linux Certifications Names In This Days ??

Hello All My Questions About Which Unix & Linux Certifications Names In This Days ? I Mean Red Hat Certifications , Solaris Certifications , IBM Certifications , HP Certifications and BSD Certifications just i need the names of these Certifications and How can i enter to Certifications... (1 Reply)
Discussion started by: Eng/G.Mohammad
1 Replies

5. Programming

DATE & TIme

Can we select the datetime from oracle database in “hhmmssnnnccyymmdd” format ? please help to solve this..... (2 Replies)
Discussion started by: Sanal
2 Replies

6. Shell Programming and Scripting

About date & time difference

Hello All, I was having a look on threads on the Forum about time calculation but didn't find exactly this issue. For instance, if we have these 2 dates, begin & end : 20100430235830 20100501000200 Is there anyway, awk, ksh, perl to calculate the difference in sec and get for... (6 Replies)
Discussion started by: rany1
6 Replies

7. Shell Programming and Scripting

Convert Epoch Time to Standard Date and Time & Vice Versa

Hi guys, I know that this topic has been discuss numerous times, and I have search the net and this forum for it. However, non able to address the problem I faced so far. I am on Solaris Platform and unable to install additional packages like the GNU date and gawk to make use of their... (5 Replies)
Discussion started by: DrivesMeCrazy
5 Replies

8. UNIX for Dummies Questions & Answers

Temporarily change the date / time

Hi - I'd like to know if it's possible to change the time on a Unix box temporarily, do some stuff, and then set it back to the correct time. I'm testing some code that reads a time (in hours) from a config file, and does something at that time. I want to be able to run regression test... (5 Replies)
Discussion started by: samgdavies
5 Replies

9. UNIX for Dummies Questions & Answers

Backup Date & Time

:confused: I'm not really sure about the default backup date & time in our Unix system and I would like to change it to a convienient time...how do I do that? Please help? (1 Reply)
Discussion started by: EbeyeJJ
1 Replies

10. UNIX for Dummies Questions & Answers

Time & Date Command

Hey all, When you run the 'ls -la' command it'll show you the time and dates of all files/directories. Now what I am trying to do is create a script that will tell me what files haven't been used in over the past 1 month and what the time and date is that the files that haven't been accessed in... (2 Replies)
Discussion started by: merlin
2 Replies
Login or Register to Ask a Question