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
5
votes
1 answer

Conversion from epoch to datetime is incorrect

I've been using this answer to convert epoch time to DateTime. I have this epoch number: epoch = 1549626705942 and do: Time.at(epoch).to_datetime However, I get this as the result: #
anemaria20
  • 1,646
  • 2
  • 17
  • 36
5
votes
9 answers

Print Epoch Time in Different Languages

As you may know, tonight, at exactly 23:31:30 UTC, Epoch Time will reach 1234567890! Hurray! One way of watching epoch time is by using Perl: perl -le 'while(true){print time();sleep 1;}' Can you do the same in another programming language?
dogbane
  • 266,786
  • 75
  • 396
  • 414
5
votes
2 answers

How can I Populate a chrono::year With the Current Year?

So I understand from this question that the integer used in the construction of a chrono::year corresponds to the Anno Domini origin of 0. So my question is, what if I wanted to get the current chrono::year. Is there a function for that? I can…
Jonathan Mee
  • 37,899
  • 23
  • 129
  • 288
5
votes
3 answers

How to find epoch format current time of GMT using java

I have written below code which is running, and giving output. But I'm not sure It's a right one. SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss"); Date date = new Date(); sdf.setTimeZone(TimeZone.getTimeZone("GMT-7")); String…
ArrchanaMohan
  • 2,314
  • 4
  • 36
  • 84
5
votes
3 answers

What is special about dates before the year 1970?

I see a lot of discussion about getting dates that are pre-1970. For example, I see people ask a question like, "how do I get a date before 1970?" What I'd like to know is what is so special about 1970? Why do people have trouble getting dates…
Saturn
  • 17,888
  • 49
  • 145
  • 271
5
votes
6 answers

Java - SimpleDateFormat formatter to return epoch time with milliseconds

I am very new to Java and coding in general - I have some code which returns a timestamp in the following format yyyy.MM.dd HH:mm:ss:ms which is shown below: SimpleDateFormat formatter = new SimpleDateFormat("yyyy.MM.dd HH:mm:ss:sss"); This…
Mark Smith
  • 757
  • 2
  • 16
  • 27
5
votes
2 answers

How to convert epoch to gregorian datetime in haskell

Let's say I have an integer representing Epoch time, for example epoch = 1499055085, and I want to convert it to UTCTime in Haskell. How can I do this? In other languages this is a very trivial task, why is it so difficult in haskell?
milad zahedi
  • 787
  • 6
  • 21
5
votes
2 answers

Convert Unix epoch as a string to time.Time on Go

I'm reading a JSON file that contains Unix Epoch dates, but they are strings in the JSON. In Go, can I convert a string in the form "1490846400" into a Go time.Time?
Tigger
  • 109
  • 1
  • 7
5
votes
1 answer

Printing Time since Epoch in Nanoseconds

So I know how to print time since epoch in seconds, and evidently even milliseconds, but when I try nanoseconds I keep getting bogus output of an integer that's way too small, and it sometimes prints numbers smaller than the last run. #include…
user5613947
5
votes
1 answer

HighCharts scatter plot with Datetime on X Axis not plotting values correctly

I am creating a highchart scatter plot with epoch DateTime values on X-Axis and a float value on Y-Axis. The problem is when I use label formatter to convert the epoch time value to a readable time value ("DD-MMM-YYYY"), multiple labels with the…
Nitin Agarwal
  • 563
  • 1
  • 6
  • 19
5
votes
1 answer

Number of digits in Epoch time

I'm working on a machine which has some code running on it which sets the time when I set the password. The time set is epoch time, but it has 13 digits in it, and when I wrote a simple program to get the epoch time and ran it on my personal…
iman453
  • 9,105
  • 16
  • 54
  • 70
5
votes
2 answers

Getting a date and time input in Eastern Time and converting to UTC timestamp in Java

I have a simple web interface that takes a date and time in the form of "2009/10/09 11:00" or "yyyy/MM/dd HH:mm". The time (from the user's standpoint) is in Eastern Time. I want to be able to take this string, convert it to a UTC timestamp, so I…
smithzo622
  • 453
  • 1
  • 7
  • 15
5
votes
2 answers

SimpleDateFormat always returns 1970.01.17 with wrong timezone

I have been using Processing 3.0, and I am trying to print a simple timestamp when my Arduino outputs certain values, but it is not working. I tried to use SimpleDateFormat, but it always returns 1970.01.17 17:48:35 GMT, rather than the actual time.…
MKII
  • 892
  • 11
  • 36
5
votes
1 answer

Is time.mktime timezone free in python?

I am trying to understand the nature of epoch, and its behavior. Below I tried the same date with 2 different timezone specific datetime with 1 naive datetime import time import pytz from datetime import datetime, timedelta pst =…
Kevin
  • 371
  • 3
  • 7
  • 14
5
votes
2 answers

Cron Expression To List of Dates/Timepoints

I was wondering what is the most efficient way/best library to parse a cron expression and return a list of time points in Java. For example I would have a cron expression, say, Fire every minute in October 2010 and would get a list/array of epoch…
noFearOfBeer
  • 77
  • 1
  • 7