Questions tagged [timestamps]

timestamp is used for questions that are about data specifying seconds since the epoch (19700101T00:00:00) or possible some other standard, and also for (date) and time information in filenames.

UNIX timestamps are often based on the count of seconds since the beginning of the day Jan 1st, 1970 (UTC).

Timestamps are used to distinguish otherwise identically named items, as well as a tag events (e.g. in log files) so they are not just sequentially ordered but can be related to real-time events.

As part of file names, timestamps are often used as the system provided timestamps (available via stat) can change if files are later updated.

572 questions
41
votes
2 answers

Why does Unix store timestamps in a signed integer?

Why is a signed integer used to represent timestamps? There is a clearly defined start at 1970 that's represented as 0, so why would we need numbers before that? Are negative timestamps used anywhere?
Bakudan
  • 535
6
votes
2 answers

change of atime, mtime or ctime of a file and of its ancestral dir?

How does change of atime, mtime or ctime of a file affect the atime, mtime or ctime of its parent directory and the atime, mtime or ctime of its ancestral directories?
Tim
  • 101,790
4
votes
3 answers

Converting epoch time format saved in a text file to human friendly format

I have a file name simcloud-target.txt where dates are saved in epoch time format i want to convert all the dates to human friendly format and print it as a list (same as the out put shown below so instead of epoch i want it in human friendly…
4
votes
1 answer

How do I modify a file without updating the modification time?

Sometimes I want to make a minor edit to a text file (e.g., fix a typo), but I want to keep its modification time unchanged. (Motivation: modtime is useful for listing directories in chronological order, for telling when a file's content was last…
alexis
  • 5,759
3
votes
1 answer

Change a file's access-, change- and modify-dates to same past date

For a utility I'm developing it would be expedient if I could set all three the named dates associated with the files in some directory to some date in the past. I know I can use touch to set the access & modify dates, but I need all three to be the…
slashmais
  • 551
3
votes
1 answer

Is it Unix timestamp incremental?

I have a simple Python program that collect data from a sensor. The program will then send the data together with the system's timestamp to a remote server via REST POST request. If the POST request fail, the data together with the timestamp will…
NAT3863
  • 133
1
vote
1 answer

Unknown timestamp format

I do not understand the time encoding of the first line below. I got it in a sample record file and I just have the number but I don't know how it transforms into the corresponding time. This is the data record: Number:7499969 REC:1:Procedure Start…
Óscar
  • 13
1
vote
1 answer

Can I convert and replace unix times stored in a file with iso 8601 format?

I tried the various solutions offered in the question of which mine appears to be a duplicate. Some of them did not actually convert the time, one of them did convert the time but the year was wrong and it did not replace the existing value in the…
1
vote
3 answers

How to change the format of a past timestamp

I've got an arbitrary time stamp 1427792481 I'm trying to implement +"%F" so I just get 2015-03-31 How can I do this? My ideal goal would be to get 20150331
3kstc
  • 4,706
0
votes
1 answer

How can get the time variable's timestamp?

In my os date Tue 01 Nov 2022 06:58:10 PM HKT Get unix timestamp date +%s 1667300297 Get the utc time. date -u Tue 01 Nov 2022 10:58:08 AM UTC If i assign a variable as a UTC time x=$(date -u) How can get the variable's timestamp then? $x …
newview
  • 205
0
votes
2 answers

use one date variable but format it different ways

In a shell script, there are the following variables: datestamp=$(date '+%Y-%m-%d_T%H-%M-%S') datestamp_pretty=$(date '+%m/%d/%Y at %I:%M:%S %p') The first one is used as part of the output filename while the second one is used to display a nicely…
knot22
  • 271
0
votes
3 answers

Unix timestamp doubt

I was converting a timestamp here, when I red the following: It should also be pointed out (thanks to the comments from visitors to this site) that this point in time technically does not change no matter where you are located on the globe.…
3000
  • 103
0
votes
1 answer

How to use time-stamp before each stdout of iPerf3?

I am using iPerf3 to measure throughput between two remote devices. The output of my iPerf command is given below -- [ 4] 0.00-0.20 sec 122 KBytes 4.98 Mbits/sec 7 29.7 KBytes [ 4] 0.20-0.40 sec 110 KBytes 4.52 Mbits/sec …
0
votes
2 answers

Create a file with a list of randomized/serialized numbers

I know that I can use the seq command to generate a sequence of numbers, such as: seq 100 999 ...and I know I can create a file with the addition of: seq 100 999 > file.txt ...but what if I wanted to perform a calculation on each number, before…
-1
votes
1 answer

Listing of files between two timestamp

I want to list down the files between two timestamp. But I can not use newer or newermt command as it doesn't support these tokens. Is there any other way to achieve this? Else I have to write too much of coding . Input Code: Dec 01 02:02 Dec 02…
1
2