Questions tagged [timestamp]

A timestamp is the time at which an event is recorded by a computer system. The timestamp term may also refer to Unix Time or to the timestamp data type.

A timestamp is a sequence of characters, denoting the date and/or time at which a certain event occurred. A timestamp is the time at which an event is recorded by a computer, not the time of the event itself. In many cases, the difference may be inconsequential: the time at which an event is recorded by a timestamp (e.g., entered into a log file) should be very, very close to the time of the occurrence of the event recorded.

In some cases, a timestamp can be just the numbering of events, the use of a date_time format to store a timestamp is then not mandatory.

This data is usually presented in a consistent format, allowing for easy comparison of two different records and tracking progress over time; the practice of recording timestamps in a consistent manner along with the actual data is called timestamping.

Timestamps are typically used for logging events, in which case each event in a log is marked with a timestamp. In filesystems, timestamp may mean the stored date/time of creation or modification of a file.


Examples of timestamps

  • 2005-10-30 T 10:45 UTC
  • 2007-11-09 T 11:20 UTC
  • Sat Jul 23 02:16:57 2005
  • 1256953732

Standardization

ISO 8601 standardizes the representation of dates and times. These standard representations are often used to construct timestamp values.


References

13570 questions
151
votes
11 answers

Sqlite: CURRENT_TIMESTAMP is in GMT, not the timezone of the machine

I have a sqlite (v3) table with this column definition: "timestamp" DATETIME DEFAULT CURRENT_TIMESTAMP The server that this database lives on is in the CST time zone. When I insert into my table without including the timestamp column, sqlite…
BrianH
  • 7,932
  • 10
  • 50
  • 71
148
votes
10 answers

Getting a timestamp for today at midnight?

How would I go about getting a timestamp in php for today at midnight. Say it's monday 5PM and I want the Timestamp for Monday(today) at midnight(12 am) which already has happened. Thank you
user1701398
  • 1,649
  • 3
  • 15
  • 16
143
votes
12 answers

Best timestamp format for CSV/Excel?

I'm writing a CSV file. I need to write timestamps that are accurate at least to the second, and preferably to the millisecond. What's the best format for timestamps in a CSV file such that they can be parsed accurately and unambiguously by Excel…
Jon
143
votes
10 answers

Convert timestamp in milliseconds to string formatted time in Java

I am trying to convert a long value (number of milliseconds elapsed from 1/1/1970 i.e. Epoch) to time of format h:m:s:ms. The long value I use as timestamp, I get from the field timestamp of a logging event from log4j. So far I've tried the…
Cratylus
  • 52,998
  • 69
  • 209
  • 339
138
votes
5 answers

How do I format {{$timestamp}} as MM/DD/YYYY in Postman?

In Postman, the dynamic variable {{$timestamp}} inserts the current Unix Time Stamp into a request. (Represented as the number of seconds since January 1, 1970) "currentTime": "1510934784" However, the API I am working with expects timestamps…
Stevoisiak
  • 23,794
  • 27
  • 122
  • 225
137
votes
7 answers

How do I add 24 hours to a unix timestamp in php?

I would like to add 24 hours to the timestamp for now. How do I find the unix timestamp number for 24 hours so I can add it to the timestamp for right now? I also would like to know how to add 48 hours or multiple days to the current timestamp.…
zeckdude
  • 15,877
  • 43
  • 139
  • 187
136
votes
21 answers

Java Date cut off time information

I have a Java Date object containing date and time information. I want to write a method that cuts off the time information, truncates the hours-minutes-seconds, so I only have the date left. Example input: 2008-01-01 13:15:00 Expected…
Marco
  • 2,005
  • 4
  • 16
  • 9
135
votes
10 answers

How to select rows that have current day's timestamp?

I am trying to select only today's records from a database table. Currently I use SELECT * FROM `table` WHERE (`timestamp` > DATE_SUB(now(), INTERVAL 1 DAY)); But this takes results for the last 24 hours, and I need it to only select results from…
Jackie Honson
  • 1,419
  • 3
  • 13
  • 12
132
votes
3 answers

Which timestamp type should I choose in a PostgreSQL database?

I would like to define a best practice for storing timestamps in my Postgres database in the context of a multi-timezone project. I can choose TIMESTAMP WITHOUT TIME ZONE and remember which timezone was used at insertion time for this field choose…
Jerome WAGNER
  • 21,986
  • 8
  • 62
  • 77
132
votes
4 answers

How to get the difference between two timestamps in seconds

Is there a way I can make a query in MySQL that will give me the difference between two timestamps in seconds, or would I need to do that in PHP? And if so, how would I go about doing that?
The.Anti.9
  • 43,474
  • 48
  • 123
  • 161
129
votes
1 answer

Update timestamp when row is updated in PostgreSQL

In MySQL, we can execute this where it updates the column changetimestamp every time the row is changed: create table ab ( id int, changetimestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP ); Is…
bichonfrise74
  • 1,987
  • 4
  • 16
  • 11
126
votes
4 answers

How to access maven.build.timestamp for resource filtering

I am using maven 3.0.4 and would like to make the build timestamp accessible to my application. For this, I'm putting a placeholder in a .properties file and let maven filter on build. While this is working fine for ${project.version},…
kostja
  • 60,521
  • 48
  • 179
  • 224
125
votes
4 answers

Obtaining a Unix Timestamp in Go Language (current time in seconds since epoch)

I have some code written in Go which I am trying to update to work with the latest weekly builds. (It was last built under r60). Everything is now working except for the following bit: if t, _, err := os.Time(); err == nil { port[5] = int32(t) …
crc
  • 1,425
  • 2
  • 11
  • 7
120
votes
8 answers

Alternative timestamping services for Authenticode

We perform code signing and timestamping for all our production builds. Occasionally (usually when we are about to RTM (!)) the timestamp server at Verisign ("http://timestamp.verisign.com/scripts/timstamp.dll") decides to go offline…
Stephen Connolly
  • 1,209
  • 2
  • 9
  • 4
120
votes
12 answers

Current time in microseconds in java

On a Unix system, is there a way to get a timestamp with microsecond level accuracy in Java? Something like C's gettimeofday function.
Seth
  • 5,596
  • 8
  • 42
  • 56