Questions tagged [year2038]

The "Year 2038 problem", a.k.a. Unix Millennium Bug, affects systems that use a signed 32-bit integer for the number of seconds since the "unix epoch" or 00:00:00 January 1, 1970. For such systems, the maximum date they are capable of expressing is 03:14:07 January 19, 2038.

Many "unix-like" systems express the current system time as the number of seconds since 00:00:00 January 1, 1970. For systems that use a signed 32-bit integer, which has a maximum possible value of 2,147,485,547, the maximum possible date is then 03:14:07 January 19, 2038, at which time adding one second will cause an integer overflow and result in a negative number, which will correspond to a time in the year 1901.

This Wikipedia article describes it in full.

67 questions
144
votes
7 answers

PHP & mySQL: Year 2038 Bug: What is it? How to solve it?

I was thinking of using TIMESTAMP to store the date+time, but I read that there is a limitation of year 2038 on it. Instead of asking my question in bulk, I preferred to break it up into small parts so that it is easy for novice users to understand…
Devner
  • 6,825
  • 11
  • 63
  • 104
66
votes
10 answers

What should we do to prepare for 2038?

I would like to think that some of the software I'm writing today will be used in 30 years. But I am also aware that a lot of it is based upon the UNIX tradition of exposing time as the number of seconds since 1970. #include #include…
Frank Krueger
  • 69,552
  • 46
  • 163
  • 208
61
votes
6 answers

When will System.currentTimeMillis() overflow?

I have a web app which orders stuff using a timestamp, which is just a long. My web app backend happens to be written in java, so I am using: long timestamp = System.currentTimeMillis(); what year (approximately) will this fail? I mean at some…
user246114
  • 50,223
  • 42
  • 112
  • 149
37
votes
4 answers

Why do timestamps have a limit to 2038?

I just found out, running a calendar script, that timestamps in PHP has a limit to 2038. What does it really mean? Why is it 2038 instead of 2050 or 2039? Why a limit if timestamps just count seconds from a given date (1970)?
Shoe
  • 74,840
  • 36
  • 166
  • 272
26
votes
3 answers

Year 2038 solution for embedded Linux (32 bit)?

What is the proper way to handle times in C code for 32-bit embedded Linux (ARMLinux) to ensure that the code continues to work properly after 03:14:07 UTC on 19 January 2038 (when a signed 32-bit time_t overflows)? Given that time_t is signed…
Ian Goldby
  • 5,609
  • 1
  • 45
  • 81
19
votes
3 answers

How to convert std::chrono::time_point to std::tm without using time_t?

I would like to print or extract year/month/day values. I don't want to use time_t because of the year 2038 problem, but all examples I found on the Internet use it to convert time_point to tm. Is there a simple way to convert from time_point to tm…
Alexej
  • 191
  • 1
  • 1
  • 4
17
votes
5 answers

Accessing dates in PHP beyond 2038

I am of of the understanding that due to the nature that PHP represents dates using milliseconds, you cannot represent dates past 2038. I have a problem where I want to calculate dates far in the future. Thousands of years away. Obviously I cannot…
Moz
  • 1,494
  • 6
  • 21
  • 32
16
votes
5 answers

Why should a Java programmer care about year 2038 bug?

Year 2038 Bug is all over the web, But this seems to be a unix issue. How will this affect java Date ?
sasivi
  • 169
  • 1
  • 3
9
votes
2 answers

JSON Web Token and the year 2038 bug

JSON Web Token is a fairly recent standard (May 2015) and yet they decided to go for UNIX timestamps in order to represent dates. Doesn't this expose the standard to a potential Year 2038 problem in the various implementations? Instead, going for…
Spack
  • 464
  • 4
  • 22
9
votes
2 answers

Why std::chrono::time_point is not large enough to store struct timespec?

I'm trying the recent std::chrono api and I found that on 64 bit Linux architecture and gcc compiler the time_point and duration classes are not able to handle the maximum time range of the operating system at the maximum resolution (nanoseconds).…
ceztko
  • 14,736
  • 5
  • 58
  • 73
9
votes
5 answers

Why can JavaScript handle timestamps beyond 2038?

As we know that all dates using Javascript Date constructor are calculated in milliseconds from 01 January, 1970 00:00:00 Universal Time (UTC) with a day containing 86,400,000 milliseconds. This implies that JS uses UNIX timestamp. I set my timer to…
Parveez Ahmed
  • 1,325
  • 4
  • 17
  • 28
8
votes
1 answer

Error converting to UTC after 2038 on 64 bit unix PHP

I need to convert date time information from local time (gtm+1) to UTC using php (5.4) on Centos 7.4 64 bits I tried the following procedure : function convertToUtc ($date) { $dateTime = new DateTime ($date, new DateTimeZone('Europe/Rome')); …
7
votes
2 answers

time(); after 2038?

Will the php function time(); be functional after the year 2038?
dynamic
  • 46,985
  • 55
  • 154
  • 231
7
votes
1 answer

"Year 2038 _problem" in Google Calendar API (Android application)

I'm building an Android application and the application enables the user to insert events to Google Calendar and external calendar (like Exchange account). The problem is that if the user wants to add an event after 2038, it creates the event in…
TamarG
  • 3,522
  • 12
  • 44
  • 74
6
votes
3 answers

How to use time > year 2038 on official Windows Python 2.5

The official Python 2.5 on Windows was build with Visual Studio.Net 2003, which uses 32 bit time_t. So when the year is > 2038, it just gives exceptions. Although this is fixed in Python 2.6 (which changed time_t to 64 bit with VS2008), I'd like to…
Francis
  • 11,388
  • 2
  • 33
  • 37
1
2 3 4 5