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
98
votes
9 answers

How to convert a string Date to long millseconds

I have a date inside a string, something like "12-December-2012". How can I convert this into milliseconds (long)?
Dawood Ahmed
  • 1,734
  • 4
  • 23
  • 36
86
votes
2 answers

Java 8: How to create a ZonedDateTime from an Epoch value?

Java 8's LocalDateTime has an ofEpochSecond method. Unfortunately, there is no such method in the ZonedDateTime. Now, I have an Epoch value and an explicit ZoneId given. How do I get a ZonedDateTime out of these?
rabejens
  • 7,594
  • 11
  • 56
  • 104
85
votes
5 answers

Get Current date in epoch from Unix shell script

How to get the current date value in epoch i.e., number of days elapsed since 1970-1-1. I need solution in unix shell script.
Krishna
82
votes
6 answers

Convert a date format in epoch

I have a string with a date format such as Jun 13 2003 23:11:52.454 UTC containing millisec... which I want to convert in epoch. Is there an utility in Java I can use to do this conversion?
user804979
  • 913
  • 1
  • 6
  • 9
79
votes
5 answers

How do I get the unix timestamp in C as an int?

I would like to get the current timestamp and print it out using fprintf.
Tim
  • 6,079
  • 8
  • 35
  • 41
69
votes
3 answers

Bash convert epoch to date, showing wrong time

How come date is converting to wrong time? result=$(ls /path/to/file/File.*) #/path/to/file/File.1361234760790 currentIndexTime=${result##*.} echo "$currentIndexTime" #1361234760790 date -d@"$currentIndexTime" #Tue 24 Oct 45105 10:53:10 PM GMT
bobbyrne01
  • 6,295
  • 19
  • 80
  • 150
56
votes
3 answers

How to convert Unix epoch time in SQLite

Could you help me convert UNIX epoch time into format yyyy-mm-dd hh:mm:ss (24h) in SQLite? (GMT+7 would be appreciated). Example: from 1319017136629 to Wednesday, October 19, 2011 4:38:56 PM GMT+7. p/s: Just looked around and found a…
Phong Tran
  • 561
  • 1
  • 4
  • 4
55
votes
4 answers

Converting epoch number to human readable date in mysql

I have a epoch number say 1389422614485. The datatype for the value storing this value is varchar. I want to convert its value to human readable time. How can we do it? Any example for this conversion?
user3675548
  • 575
  • 1
  • 4
  • 5
52
votes
14 answers

Javascript Convert Date Time string to Epoch

so I give up...been trying to do this all day; I have a string that supplies a date and time in the format dd/MM/yyyy hh:mm (04/12/2012 07:00). I need to turn that into an Epoch date so I can do some calculations upon it. I cannot modify the format…
cbm64
  • 1,059
  • 2
  • 12
  • 24
49
votes
6 answers

How to convert epoch to datetime redshift?

I work in dbeaver. I have a table x. TABLE x has a column "timestamp" 1464800406459 1464800400452 1464800414056 1464800422854 1464800411797 The result I want: Wed, 01 Jun 2016 17:00:06.459 GMT Wed, 01 Jun 2016 17:00:00.452 GMT Wed, 01 Jun 2016…
khusnanadia
  • 813
  • 2
  • 7
  • 20
49
votes
7 answers

Convert Epoch Time to Date PHP

I'm using an API right now and it provides an epochTime. I've tried everything to convert this epochtime to date, but it doesn't seem to be working including $epoch_time / 1000 and then using the date() function to convert it. The epoch time looks…
user1701252
  • 1,501
  • 1
  • 11
  • 19
47
votes
4 answers

Is a day always 86,400 epoch seconds long?

While reviewing my past answers, I noticed I'd proposed code such as this: import time def dates_between(start, end): # muck around between the 9k+ time representation systems in Python # now start and end are seconds since epoch # return…
badp
  • 11,409
  • 3
  • 61
  • 89
45
votes
5 answers

Use Moment.js to convert Unix epoch time to human readable time

I'm trying to use Moment.js to convert a Unix epoch time to a date and time. I'd also like to know how to have it formatted like below. Tuesday, November 22, 2016 6:00 PM
danny
  • 461
  • 1
  • 4
  • 4
43
votes
6 answers

Convert a column of datetimes to epoch in Python

I'm currently having an issue with Python. I have a Pandas DataFrame and one of the columns is a string with a date. The format is : "%Y-%m-%d %H:%m:00.000". For example : "2011-04-24 01:30:00.000" I need to convert the entire column to integers.…
marcsarfa
  • 616
  • 1
  • 8
  • 15
42
votes
4 answers

Is it possible to set a git commit to have a timestamp prior to 1970?

Unix timestamps are signed 32 bit integers (64 bit on some systems today, or so I understand). On some software products this allows you to use dates going back as far as 1903 or so. However, when I try the following: git commit -m "this is a test…
John O
  • 4,863
  • 8
  • 45
  • 78
1
2
3
95 96