Questions tagged [epoch]

Unix time, or POSIX time, is a system for describing points in time, defined as the number of seconds elapsed since midnight Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds. This tag is *not* for epochs as used in neural networks/machine learning.

Unix time, or POSIX time, is a system for describing points in time, defined as the number of seconds elapsed since midnight Coordinated Universal Time (UTC) of January 1, 1970, not counting leap seconds.

It is used widely, not only in Unix-like operating systems, but also in many other computing systems and file formats.

It is neither a linear representation of time nor a true representation of UTC (though it is frequently mistaken for both), as it cannot unambiguously represent UTC leap seconds (e.g. December 31, 1998 23:59:60), although otherwise the times it represents are UTC.

Unix time may be checked on some Unix systems by typing date +%s on the command line.

1440 questions
7
votes
4 answers

Seconds since epoch to relative date

I'm working with dates since epoch, and already got, for example: date = 6928727.56235 I'd like to transform this into another relative format, so that I'll be able to transform this into something relative to epoch. Using time.gmtime(date), it…
Gabriel L. Oliveira
  • 3,922
  • 6
  • 31
  • 40
7
votes
3 answers

Jackson: deserialize epoch to LocalDate

I have following JSON: { "id" : "1", "birthday" : 401280850089 } And POJO class: public class FbProfile { long id; @JsonDeserialize(using = LocalDateDeserializer.class) LocalDate birthday; } I am using Jackson to do…
kpater87
  • 1,190
  • 12
  • 31
7
votes
1 answer

Does Time.to_i always return number of seconds since EPOCH in UTC?

Is the timezone difference always ignored, regardless in which zone the time is expressed in? Intuitively, the number of seconds passed since EPOCH should be higher for those who are, for example, in UTC+2. However, this seems not to be the case.
randomguy
  • 12,042
  • 16
  • 71
  • 101
7
votes
7 answers

In the database, why can't we just use "Long" integers for dates (millis since epoch)

I would like to use a Long datatype in the database to represent dates (as millis since epoch). The reason why, is that storing dates is so complex with the jdbc driver and Oracle engine. If you submit the wrong datatype in preparedStatement it…
JChristopher
  • 117
  • 1
  • 4
7
votes
2 answers

How to convert NTP time to Unix Epoch time in C language (Linux)

I have been trying for several months to create a simple SNTP single Client/Server based on RFC5905. Finally I manage to make it work at least I think it works correctly, but when I tried to test my code against a real NTP server (e.g.…
Thanos
  • 1,618
  • 4
  • 28
  • 49
7
votes
7 answers

How can I change the timezone of a datetime value in Perl?

Using this function: perl -e 'use Time::Local; print timelocal("00","00","00","01","01","2000"),"\n";' It will return an epochtime - but only in GMT - if i want the result in GMT+1 (which is the systems localtime(TZ)), what do i need to…
Anders
  • 6,188
  • 4
  • 26
  • 31
7
votes
3 answers

Get milliseconds from epoch via HTTP

I am working on a microcontroller and don't want to keep track of time with the system clock. I want to make an HTTP request to get the current time in milliseconds from the epoch (1970). I already know how to form all the requests, I just can't…
Kyle Weller
  • 2,533
  • 9
  • 35
  • 45
7
votes
1 answer

Getting human readable date from Epoch into variable

Okay, this is probably a very basic question; but, I'm just getting back in the saddle with Linux. I have a variable that hold an Epoch time called pauseTime. I need that variable to become human readable (something like 2012-06-13 13:48:30). I know…
w3bguy
  • 2,215
  • 1
  • 19
  • 34
6
votes
2 answers

JQuery Datepicker Set Value As Epoch Time

I use a data picker like that: $('#startTime').datepicker("option", "dateFormat", 'yy-mm-dd '); However when I want to set it I have a epoch time value that comes from my server (milliseconds since the standard base time January 1, 1970) How can I…
kamaci
  • 72,915
  • 69
  • 228
  • 366
6
votes
2 answers

epoch time and MySQL query

I have a table like this: id | date ---- | ----------- 1 | 1319043263 2 | 1319043578 which date field format is in epoch. I have to group every row that belongs to same day and show them in a separate group. How can I do that in…
silvercover
  • 161
  • 1
  • 3
  • 11
6
votes
3 answers

How can I round Time epoch to previous midnight

Let's say I have : time in msec = 1655205146419 , which is generated using : auto msec = duration_cast(system_clock::now().time_since_epoch()).count(); Tuesday, June 14, 2022 11:12:26.419 AM And I want to round it up to the previous…
MinaP2022
  • 61
  • 2
6
votes
3 answers

Why the difference between datetime.datetime.now().timestamp() and datetime.datetime.utcnow().timestamp()?

As I understand the seconds since Unix epoch (1970-01-01 00:00:00 UTC) should be the same everywhere around the globe, since it is fixed to UTC. Now, if you are in a timezone with some hours +/- UTC, why do you get different timestamps if you do…
TeXnophobe
  • 63
  • 1
  • 4
6
votes
2 answers

Converting time to epoch (Python)

I am using tweepy to get a tweet. I am trying to send this tweet over Slack. Tweepy gives the time in a strange format, and Slack requires the time in epoch. for i in tweets: created=(i.created_at) print(created) …
user2607110
  • 127
  • 1
  • 10
6
votes
2 answers

Get first and last times from pcap file with Wireshark command line tools (like tshark)

I have a huge collection of PCAP files, some of which have been "touched" since they were captured. This means the system timestamp on the file may not equate to the time of the data capture. Additionally, most of the files are autosaves from…
Trashman
  • 1,424
  • 18
  • 27
6
votes
2 answers

How to get timestamp as Unix epoch from postgres?

I want to get data from Postgres. There is a column in type timestamp without timezone. Simple SELECT returns me formatted date but I want timestamp in miliseconds simply. How I can do it in SQL?
Kamilos
  • 795
  • 2
  • 10
  • 25