LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
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 08-26-2018, 03:25 PM   #1
Entropy1024
Member
 
Registered: Dec 2012
Location: UK
Distribution: Ubuntu 16 & 17
Posts: 130

Rep: Reputation: Disabled
Changing hours in files


I'm moving files from a server in NY to a PC in London. All the files are timestamped with East coast time, ie 5 hours behind UK time.
I would like to change them to UK time. Is there some way to advance the hour on each file by five hours?

Many thanks
 
Old 08-26-2018, 03:44 PM   #2
scasey
Senior Member
 
Registered: Feb 2013
Location: Tucson, AZ, USA
Distribution: CentOS 7.7.1908
Posts: 4,073

Rep: Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386Reputation: 1386
Code:
man touch
'tho if you want to preserve the date and only change the time, there will be some scripting involved.

Still, touch is the starting place.
 
Old 08-26-2018, 03:47 PM   #3
Turbocapitalist
Senior Member
 
Registered: Apr 2005
Distribution: Linux Mint, Devuan, OpenBSD
Posts: 4,252
Blog Entries: 3

Rep: Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110Reputation: 2110
From what I understand the date and time of the files is stored independently of the timezone it is displayed in. The actual time is in Epoch seconds so if your transfer method preserves the time and date, then in the new timezone the correct time will be displayed. So 12:01 Eastern will be 17:01 UTC.

If you want to see the files in a different zone, set the environment variable accordingly.

Code:
touch foo;
ls -lh foo;
TZ='Europe/Berlin' ls -lh foo;
TZ='Europe/London' ls -lh foo;
On the remote system the time zone will be different but the file the "same" age as always.

Which means are you using to transfer the files?
 
Old 08-26-2018, 07:55 PM   #4
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 18,288

Rep: Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993Reputation: 2993
Quote:
Originally Posted by Turbocapitalist View Post
From what I understand the date and time of the files is stored independently of the timezone it is displayed in. The actual time is in Epoch seconds ...
Interesting - I always though it was store as a UTC value, but debugfs suggests you are correct. For atime and mtime the value can be set by for example "touch", however the creation time (from touch) is always the real epoch offset of the actual creation of the file. The things you learn ...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Find for files older than 12 hours rjo98 Linux - Newbie 5 06-13-2013 11:44 AM
Deleting files older than 1 hours a4kata Linux - Newbie 2 09-08-2009 01:01 PM
files edit in the last 2 hours hosney00ux Linux - General 7 08-25-2009 08:24 AM
Search only the last 24 hours files davholla Linux - General 1 04-13-2006 10:09 AM
Delete files after 24 hours Azhrarn Linux - Newbie 3 08-29-2005 01:00 PM

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

All times are GMT -5. The time now is 02:11 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration