The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
How to find a date which is 7 days past when given current date ladtony Shell Programming and Scripting 17 04-09-2009 04:06 PM
Temporarily change the date / time samgdavies UNIX for Dummies Questions & Answers 5 09-15-2008 05:15 AM
Need to get 4 Hrs back time and compare with successive time maanik85 UNIX for Dummies Questions & Answers 2 07-15-2008 08:48 AM
To retrieve Date/Time from Windows by unix/linux boxes mpc8250 Shell Programming and Scripting 4 02-09-2008 12:31 AM
forcing password change every X days? amheck SUN Solaris 1 05-23-2006 07:14 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-29-2008
komala komala is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 2
Wink 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 (permalink)  
Old 09-29-2008
jim mcnamara jim mcnamara is offline Forum Staff  
...@...
  
 

Join Date: Feb 2004
Location: NM
Posts: 5,715
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 (permalink)  
Old 09-29-2008
rajendra44 rajendra44 is offline
Registered User
  
 

Join Date: Feb 2008
Posts: 10
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 (permalink)  
Old 09-30-2008
Grippo Grippo is offline
Registered User
  
 

Join Date: Jan 2008
Posts: 41
Quote:
Originally Posted by komala View Post
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 (permalink)  
Old 09-30-2008
komala komala is offline
Registered User
  
 

Join Date: Sep 2008
Posts: 2
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.
Sponsored Links
Closed Thread

Bookmarks

Tags
linux commands, unix commands

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

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 On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 04:44 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0