1<!DOCTYPE html> 2<html lang="en"> 3<head> 4<meta charset="utf-8"> 5<meta name="viewport" content="width=device-width, initial-scale=1"><title>Epoch / Unix timestamp functions</title><link rel="preconnect" href="https://cdnjs.cloudflare.com" crossorigin><link rel="preconnect" href="https://www.googletagmanager.com"> 6<link rel="canonical" href="https://www.epochconverter.com/programming/" /><meta name="format-detection" content="telephone=no"> 7<link rel="apple-touch-icon" href="/img/apple-touch-icon.png" sizes="180x180"> 8<link rel="shortcut icon" href="/img/epoch.ico"> 9<link rel="icon" href="/img/favicon-192x192.png" type="image/png" sizes="192x192"> 10<link rel="icon" href="/img/favicon-32x32.png" type="image/png" sizes="32x32"> 11<link rel="manifest" href="/img/site.webmanifest"><meta name="description" content="Find programming functions and routines for converting between epoch (Unix timestamps) and human-readable dates in various programming languages, databases, and operating systems. This page provides code examples for languages such as C, Go, Java, Python, and more."><link rel="stylesheet" href="/css/epoch.min.css?v=106" type="text/css" /> <meta property="og:type" content="website"> 12 <meta property="og:title" content="Epoch / Unix timestamp functions - Epoch Converter"> 13 <meta property="og:description" content="Find programming functions and routines for converting between epoch (Unix timestamps) and human-readable dates in various programming languages, databases, and operating systems. This page provides code examples for languages such as C, Go, Java, Python, and more."> 14 <meta property="og:url" content="https://www.epochconverter.com/programming/"> 15 <meta property="og:image" content="https://www.epochconverter.com/img/og/epochconverter-og.jpg">
15<script>
vendor: 335 bytes, lines 15-19
15(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': 16 new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], 17 j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= 18 'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); 19 })(window,document,'script','dataLayer','
19GTM-2B52
vendor: 3 bytes, line 19
19');
19</script>
19<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.12.0/styles/atom-one-light.min.css" integrity="sha512-o5v54Kh5PH0dgnf9ei0L+vMRsbm5fvIvnR/XkrZZjN4mqdaeH7PW66tumBoQVIaKNVrLCZiBEfHzRY4JJSMK/Q==" crossorigin="anonymous" referrerpolicy="no-referrer" /><style type="text/css">@font-face {font-family:'Inter';font-style:normal;font-weight:400;src:url(/cf-fonts/v/inter/5.2.8/latin-ext/wght/normal.woff2);unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:400;src:url(/cf-fonts/v/inter/5.2.8/vietnamese/wght/normal.woff2);unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:400;src:url(/cf-fonts/v/inter/5.2.8/cyrillic-ext/wght/normal.woff2);unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:400;src:url(/cf-fonts/v/inter/5.2.8/latin/wght/normal.woff2);unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:400;src:url(/cf-fonts/v/inter/5.2.8/cyrillic/wght/normal.woff2);unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:400;src:url(/cf-fonts/v/inter/5.2.8/greek-ext/wght/normal.woff2);unicode-range:U+1F00-1FFF;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:400;src:url(/cf-fonts/v/inter/5.2.8/greek/wght/normal.woff2);unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:500;src:url(/cf-fonts/v/inter/5.2.8/cyrillic-ext/wght/normal.woff2);unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:500;src:url(/cf-fonts/v/inter/5.2.8/latin/wght/normal.woff2);unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:500;src:url(/cf-fonts/v/inter/5.2.8/vietnamese/wght/normal.woff2);unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:500;src:url(/cf-fonts/v/inter/5.2.8/greek-ext/wght/normal.woff2);unicode-range:U+1F00-1FFF;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:500;src:url(/cf-fonts/v/inter/5.2.8/latin-ext/wght/normal.woff2);unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:500;src:url(/cf-fonts/v/inter/5.2.8/cyrillic/wght/normal.woff2);unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:500;src:url(/cf-fonts/v/inter/5.2.8/greek/wght/normal.woff2);unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:600;src:url(/cf-fonts/v/inter/5.2.8/latin-ext/wght/normal.woff2);unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1D
19BF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:600;src:url(/cf-fonts/v/inter/5.2.8/cyrillic/wght/normal.woff2);unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:600;src:url(/cf-fonts/v/inter/5.2.8/latin/wght/normal.woff2);unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:600;src:url(/cf-fonts/v/inter/5.2.8/greek/wght/normal.woff2);unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:600;src:url(/cf-fonts/v/inter/5.2.8/greek-ext/wght/normal.woff2);unicode-range:U+1F00-1FFF;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:600;src:url(/cf-fonts/v/inter/5.2.8/cyrillic-ext/wght/normal.woff2);unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;font-display:swap;}@font-face {font-family:'Inter';font-style:normal;font-weight:600;src:url(/cf-fonts/v/inter/5.2.8/vietnamese/wght/normal.woff2);unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;font-display:swap;}@font-face {font-family:'Plus Jakarta Sans';font-style:normal;font-weight:500;src:url(/cf-fonts/v/plus-jakarta-sans/5.2.8/cyrillic-ext/wght/normal.woff2);unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F;font-display:swap;}@font-face {font-family:'Plus Jakarta Sans';font-style:normal;font-weight:500;src:url(/cf-fonts/v/plus-jakarta-sans/5.2.8/vietnamese/wght/normal.woff2);unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB;font-display:swap;}@font-face {font-family:'Plus Jakarta Sans';font-style:normal;font-weight:500;src:url(/cf-fonts/v/plus-jakarta-sans/5.2.8/latin-ext/wght/normal.woff2);unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF;font-display:swap;}@font-face {font-family:'Plus Jakarta Sans';font-style:normal;font-weight:500;src:url(/cf-fonts/v/plus-jakarta-sans/5.2.8/latin/wght/normal.woff2);unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD;font-display:swap;}</style>
20<script>function showLoading(id){var r=id?document.getElementById(id):null;if(!r&&document.activeElement&&document.activeElement.form)r=document.activeElement.form.querySelector(".resultbox");if(!r&&id)r=document.getElementById(id);if(r)r.innerHTML="The converter is still loading... please wait a few seconds.";}try {var _t = localStorage.getItem('theme');if (_t === 'dark') {document.documentElement.classList.add('dark');}else if (_t === 'system') {document.documentElement.classList.add('system');if (window.matchMedia && window.matchMedia('(prefers-color-scheme: dark)').matches) {document.documentElement.classList.add('dark');}}} catch (err) {}</script>
20</head><body class=""><a class="sr-only sr-only-focusable" href="#contentwrapper">Skip to content</a><a class="sr-only hidemobile sr-only-focusable" href="#rightcolumn">Skip to navigation</a>
vendor: 67 bytes, line 20
20<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=
20GTM-2B52
vendor: 83 bytes, lines 20-21
20" 21height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
22<span id="top"></span><span id="responsive"></span> 23<div id="maincontainer"> 24 25<header id="topsection" role="banner"><div class="innertube"> 26<a class="logo" href="https://www.epochconverter.com"><span class="logo">Epoch Converter</span></a> 27<div id="header-buttons"><span id="themebtnlink"><button type="button" id="theme-btn" onClick='themePanelToggle(event); return false;' aria-label="Theme" title="Theme" aria-controls="theme-popover" aria-expanded="false"><span id="theme-btn-icon"><i class="fa icon-light fa-fw" aria-hidden="true"></i><i class="fa fa-angle-down" aria-hidden="true"></i></span></button><div id="theme-popover" hidden><div id="theme-popover-toggles" class="cal-toggle-group cal-toggle-group--vertical" role="group" aria-label="Theme"><button type="button" class="cal-toggle" data-val="light">Light</button><button type="button" class="cal-toggle middle" data-val="dark">Dark</button><button type="button" class="cal-toggle" data-val="system">Auto</button></div></div></span><span id="settingslink"><button type="button" onClick='settingsPanelToggle(event); return false;' aria-label="Preferences" title="Preferences" aria-controls="settingspanel" aria-expanded="false" class="btn-settings"></button></span><span id="mobilemenulink"><button type="button" onClick='mobileMenu(); return false;' aria-label="Menu" title="Menu" aria-controls="rightcolumn" aria-expanded="false">☰</button></span></div>
27<script> 28window.toggleMenuIcon = function(t,e){t&&(t.classList.toggle("fa-angle-up",e),t.classList.toggle("fa-angle-down",!e))}; 29(function(){var i=document.getElementById('theme-btn-icon');if(i&&document.documentElement.classList.contains('dark')){i.innerHTML='<i class="fa icon-dark fa-fw" aria-hidden="true"><\/i><i class="fa fa-angle-down" aria-hidden="true"><\/i>';}else if(i&&document.documentElement.classList.contains('system')){i.innerHTML='<i class="fa icon-auto fa-fw" aria-hidden="true"><\/i><i class="fa fa-angle-down" aria-hidden="true"><\/i>';}}());</script>
29 30 31<h1>Epoch / Unix timestamp functions</h1><div class="ad_code ad_center"><span class="bnr_full">
32<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-8772506942141059" crossorigin="anonymous"></script>
32 33<ins class="adsbygoogle bnr_full" 34style="display:inline-block" 35data-ad-client="ca-pub-8772506942141059" 36data-ad-slot="6472539480" 37data-ad-format="horizontal,rectangle" 38data-full-width-responsive="true"></ins>
39<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
39 40</span></div></div></header> 41 42<main id="contentwrapper" role="main" tabindex="-1"> 43<div id="contentcolumn"> 44<div id="jqlocl"></div> 45<div class="innertube"> 46<h2>Code snippets by language A-Z</h2> 47<p>In the examples on this page, 1800000000 is used as an example epoch time. Replace it with your own value to convert it.</p> 48 49<h3>Current programming languages, OSes and databases</h3> 50<ul class="indexlist"> 51<li><a href="#autoit">AutoIT routines</a></li> 52<li><a href="/programming/c">C routines</a></li> 53<li><a href="#csharp">C# routines</a></li> 54<li><a href="#cpp20">C++20 routines</a></li> 55<li><a href="#crystal">Crystal routines</a></li> 56<li><a href="#dart">Dart routines</a></li> 57<li><a href="#delphi">Delphi routines</a></li> 58<li><a href="#elixir">Elixir routines</a></li> 59<li><a href="#erlang">Erlang/OTP routines</a></li> 60<li><a href="#gleam">Gleam routines</a></li> 61<li><a href="#go">Go routines</a></li> 62<li><a href="#bigquery">Google BigQuery routines</a></li> 63<li><a href="#groovy">Groovy/Jenkins routines</a></li> 64<li><a href="#java">Java routines</a></li> 65<li><a href="#javascript">JavaScript routines</a></li> 66<li><a href="#julia">Julia routines</a></li> 67<li><a href="#kotlin">Kotlin routines</a></li> 68<li><a href="#lua">Lua routines</a></li> 69<li><a href="#macos">macOS commands</a></li> 70<li><a href="#matlab">MATLAB routines</a></li> 71<li><a href="#excel">Microsoft Excel / LibreOffice Calc</a></li> 72<li><a href="#mojo">Mojo routines</a></li> 73<li><a href="/programming/mysql">MySQL queries</a></li> 74<li><a href="#nim">Nim routines</a></li> 75<li><a href="#objectivec">Objective-C routines</a></li> 76<li><a href="#oraclesql">Oracle PL/SQL routines</a></li> 77<li><a href="/programming/perl">Perl routines</a></li> 78<li><a href="/programming/php">PHP routines</a></li> 79<li><a href="#postgresql">PostgreSQL routines</a></li> 80<li><a href="#powershell">PowerShell routines</a></li> 81<li><a href="#python">Python routines</a></li> 82<li><a href="#r">R routines</a></li> 83<li><a href="#ruby">Ruby routines</a></li> 84<li><a href="#rust">Rust routines</a></li> 85<li><a href="#solidity">Solidity routines</a></li> 86<li><a href="#sqlserver">SQL Server routines</a></li> 87<li><a href="#sqlite">SQLite routines</a></li> 88<li><a href="#swift">Swift routines</a></li> 89<li><a href="#tcltk">Tcl/Tk routines</a></li> 90<li><a href="#unixshell">Unix/Linux Shell (Bash) commands</a></li> 91<li><a href="#zig">Zig routines</a></li> 92</ul> 93 94<h3>Legacy / EOL</h3> 95<ul class="indexlist"> 96<li><a href="#coldfusion">Adobe ColdFusion routines</a></li> 97<li><a href="#asp">ASP / VBScript routines</a></li> 98<li><a href="#crystalreports">Crystal Reports routines</a></li> 99<li><a href="#ibminformix">IBM Informix routines</a></li> 100<li><a href="#ibmpuredata">IBM PureData System for Analytics routines</a></li> 101<li><a href="#solaris">Solaris (OS commands)</a></li> 102<li><a href="#visualfoxpro">Visual FoxPro routines</a></li> 103</ul> 104 105<div class="ad_code"><span class="bnr_content"> 106 107<ins class="adsbygoogle bnr_content" 108style="display:inline-block" 109data-ad-client="ca-pub-8772506942141059" 110data-ad-slot="6472539480" 111data-ad-format="horizontal,rectangle" 112data-full-width-responsive="true"></ins>
113<script>(adsbygoogle = window.adsbygoogle || []).push({});</script>
113 114</span></div> 115<h2 id="autoit">AutoIT routines</h2> 116<p><b>Get current epoch (seconds):</b></p> 117<pre><code class="vbnet">_DateDiff('s', "1970/01/01 00:00:00", _NowCalc())</code></pre> 118 119<p><b>Convert human-readable date to epoch:</b></p> 120<pre><code class="vbnet">_DateDiff('s', "1970/01/01 00:00:00", "YYYY/MM/DD HH:MM:SS")</code></pre> 121 122<p><b>Convert epoch to human-readable date:</b></p> 123<pre><code class="vbnet">_DateAdd("s", $EpochSeconds , "1970/01/01 00:00:00")</code></pre> 124 125 126<h2 id="csharp">C# routines</h2> 127 128<p><b>Get current epoch (seconds):</b></p> 129<pre><code class="csharp">DateTimeOffset.Now.ToUnixTimeSeconds()</code></pre> 130<p>(.NET Framework 4.6+/.NET Core).</p> 131 132<p>Older versions:</p> 133<pre><code class="csharp">var epoch = (DateTime.UtcNow - new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc)).TotalSeconds;</code></pre> 134 135<p><b>Convert epoch to human-readable date:</b></p> 136<pre><code class="csharp">private string epoch2string(int epoch) { 137return new DateTime(1970, 1, 1, 0, 0, 0, DateTimeKind.Utc).AddSeconds(epoch).ToShortDateString(); }</code></pre> 138 139 140<h2 id="cpp20">C++20 routines</h2> 141 142<p><b>Get current epoch (seconds):</b></p> 143<pre><code class="cpp">auto now = std::chrono::duration_cast<std::chrono::seconds>( 144 std::chrono::system_clock::now().time_since_epoch() 145).count(); 146</code></pre> 147 148<p><b>Convert epoch to human-readable date:</b></p> 149<pre><code class="cpp">auto date = std::chrono::system_clock::from_time_t(1800000000); 150std::cout << std::format("{:%F %T}", date);</code></pre> 151 152 153<h2 id="crystal">Crystal routines</h2> 154 155<p><b>Get current epoch (seconds):</b></p> 156<pre><code class="ruby">Time.utc.to_unix</code></pre> 157 158<p><b>Convert human-readable date to epoch:</b></p> 159<pre><code class="ruby">Time.parse_utc("2030-07-01 02:30:00", "%Y-%m-%d %H:%M:%S").to_unix</code></pre> 160 161<p><b>Convert epoch to human-readable date:</b></p> 162<pre><code class="ruby">Time.unix(1800000000)</code></pre> 163 164 165<h2 id="dart">Dart routines</h2> 166 167<p><b>Get current epoch:</b></p> 168<pre><code class="java">DateTime.now().millisecondsSinceEpoch ~/ 1000</code></pre> 169 170<p>In microseconds:</p> 171<pre><code class="java">DateTime.now().microsecondsSinceEpoch</code></pre> 172 173<p><b>Convert epoch to human-readable date:</b></p> 174<pre><code class="java">DateTime.fromMillisecondsSinceEpoch(1800000000*1000)</code></pre> 175 176 177<h2 id="delphi">Delphi routines</h2> 178 179<p><b>Get current epoch (seconds):</b></p> 180<pre><code class="plaintext">Epoch := DateTimeToUnix(Now, False);</code></pre> 181<p>There is also a DateTimeToMillisecondsSince1970 function.</p> 182 183<p><b>Convert human-readable date to epoch:</b></p> 184<pre><code class="plaintext">Epoch := DateTimeToUnix(StrToDateTime(myString));</code></pre> 185 186<p><b>Convert epoch to human-readable date:</b></p> 187<pre><code class="plaintext">myString := DateTimeToStr(UnixToDateTime(Epoch));</code></pre> 188<p>Where Epoch is a signed integer.</p> 189 190 191<h2 id="elixir">Elixir routines</h2> 192 193<p><b>Get current epoch (seconds):</b></p> 194<pre><code class="ruby">System.os_time(:second)</code></pre> 195 196<p><b>Convert human-readable date to epoch:</b></p> 197<pre><code class="ruby">{:ok, datetime, _} = DateTime.from_iso8601("2030-07-01T02:30:00Z") 198DateTime.to_unix(datetime)</code></pre> 199 200<p><b>Convert epoch to human-readable date:</b></p> 201<pre><code class="ruby">DateTime.from_unix!(1800000000)</code></pre> 202 203 204<h2 id="erlang">Erlang/OTP routines</h2> 205 206<p><b>Get current epoch (seconds):</b></p> 207<pre><code class="plaintext">erlang:system_time(seconds).</code></pre> 208 209 210<h2 id="gleam">Gleam routines</h2> 211 212<p><b>Get current epoch (seconds):</b></p> 213<pre><code class="rust">import gleam/pair 214import gleam/time/timestamp 215 216pub fn get_epoch() -> Int { 217 timestamp.system_time() 218 |> timestamp.to_unix_seconds_and_nanoseconds 219 |> pair.first 220}</code></pre> 221 222 223<h2 id="go">Go routines</h2> 224 225<pre><code class="go">package main 226 227import ( 228 "fmt" 229 "time" 230) 231 232func main() { 233 // Current epoch time 234 fmt.Printf("Current epoch time is:\t\t\t%d\n\n", currentEpochTime()) 235 236 // Convert from human-readable date to epoch 237 humanReadable := time.Now() 238 fmt.Printf("Human-readable time is:\t\t\t%s\n", humanReadable) 239 fmt.Printf("Human-readable to epoch time is:\t%d\n\n", humanReadableToEpoch(humanReadable)) 240 241 // Convert from epoch to human-readable date 242 epoch := currentEpochTime() 243 fmt.Printf("Epoch to human-readable time is:\t%s\n", epochToHumanReadable(epoch)) 244} 245 246func currentEpochTime() int64 { 247 return time.Now().Unix() 248 // time.Now().UnixMilli() for milliseconds 249} 250 251func humanReadableToEpoch(date time.Time) int64 { 252 return date.Unix() 253} 254 255func epochToHumanReadable(epoch int64) time.Time { 256 return time.Unix(epoch, 0) 257} 258 259</code></pre> 260 261<h2 id="bigquery">Google BigQuery routines</h2> 262 263<p><b>Get current epoch (seconds):</b></p> 264<pre><code class="sql">SELECT UNIX_SECONDS(CURRENT_TIMESTAMP()) AS unix_seconds;</code></pre> 265<p>Change to UNIX_MILLIS(CURRENT_TIMESTAMP()) for milliseconds.</p> 266<p><b>Convert epoch to human-readable date:</b></p> 267<pre><code class="sql">SELECT TIMESTAMP_SECONDS(event_time.seconds) as readable_time 268FROM `your_project.dataset.table`; 269</code></pre> 270 271 272<h2 id="groovy">Groovy/Jenkins routines</h2> 273 274<p><b>Get current epoch (seconds):</b></p> 275<pre><code class="java">System.currentTimeMillis() / 1000</code></pre> 276 277 278<p><b>Convert epoch to human-readable date:</b></p> 279<pre><code class="java">import java.time.Instant 280import java.time.ZoneId 281import java.time.format.DateTimeFormatter 282 283long unixTimestamp = 1800000000L 284 285def instant = Instant.ofEpochSecond(unixTimestamp) 286 287def formatter = DateTimeFormatter.ofPattern("dd-MM-yyyy HH:mm:ss") 288 .withZone(ZoneId.of("Europe/London")) 289 290println "Readable date: ${formatter.format(instant)}" 291</code></pre> 292 293 294<h2 id="java">Java routines</h2> 295 296<p><b>Get current epoch (seconds):</b></p> 297<pre><code class="java">long epoch = System.currentTimeMillis()/1000;</code></pre> 298 299<p><b>Convert human-readable date to epoch:</b></p> 300<pre><code class="java">long epoch = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse("01/01/1970 01:00:00").getTime() / 1000;</code></pre> 301<p>Timestamp in seconds, remove '/1000' for milliseconds.</p> 302 303<p><b>Convert epoch to human-readable date:</b></p> 304<pre><code class="java">String date = new java.text.SimpleDateFormat("MM/dd/yyyy HH:mm:ss").format(new java.util.Date(epoch*1000));</code></pre> 305<p>Epoch in seconds, remove '*1000' for milliseconds.</p> 306 307 308<h2 id="javascript">JavaScript routines</h2> 309 310<p><b>Get current epoch (seconds):</b></p> 311<pre><code class="javascript">Math.floor(new Date().getTime()/1000.0)</code></pre> 312 313<p><b>Convert an epoch to human-readable date:</b></p> 314 315Example with epoch date '1800000000': 316<pre><code class="javascript">var myDate = new Date(1800000000*1000); 317document.write("UTC: "+myDate.toUTCString()+"<br>
317Local: "+myDate.toLocaleString()); 318</code></pre> 319 320<p>The example above gives the following output (with epoch date 123):</p> 321<pre>
321<script>var myDate = new Date(1800000000*1000);document.write("UTC: "+myDate.toUTCString()+"<br>Local: "+myDate.toLocaleString());</script>
321</pre> 322 323<b>Convert human-readable dates to epoch:</b></p> 324<pre><code class="javascript">var myDate = new Date("July 1, 2030 02:30:00"); // Your timezone! 325var myEpoch = myDate.getTime()/1000.0; 326document.write(myEpoch); 327</code></pre> 328 329<p>The example above gives the following output:</p> 330<pre>
330<script>var myDate = new Date("July 1, 2030 02:30:00");var myEpoch = myDate.getTime()/1000.0;document.write(myEpoch);</script>
330</pre> 331 332<p>There are many ways to create dates in JavaScript (for example with setFullYear, setMonth, setDay, etc.).</p> 333 334 335<h2 id="julia">Julia routines</h2> 336 337<p><b>Get current epoch (seconds):</b></p> 338<pre><code class="plaintext">time()</code></pre> 339 340<p><b>Convert human-readable date to epoch:</b></p> 341<pre><code class="plaintext">using Dates 342datetime2unix(DateTime("2030-07-01T02:30:00"))</code></pre> 343 344<p><b>Convert epoch to human-readable date:</b></p> 345<pre><code class="plaintext">using Dates 346unix2datetime(1800000000)</code></pre> 347 348 349<h2 id="kotlin">Kotlin routines</h2> 350 351<p><b>Get current epoch (seconds):</b></p> 352<pre><code class="kotlin">java.time.Instant.now().epochSecond</code></pre> 353 354<p><b>Convert human-readable date to epoch:</b></p> 355<pre><code class="kotlin">import java.time.Instant 356import java.time.format.DateTimeFormatter 357import java.time.ZoneId 358 359val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.of("UTC")) 360val epoch = Instant.from(formatter.parse("2030-07-01 02:30:00")).epochSecond</code></pre> 361 362<p><b>Convert epoch to human-readable date:</b></p> 363<pre><code class="kotlin">import java.time.Instant 364import java.time.ZoneId 365 366val dateTime = Instant.ofEpochSecond(1800000000).atZone(ZoneId.of("UTC")).toLocalDateTime()</code></pre> 367 368 369<h2 id="lua">Lua routines</h2> 370 371<p><b>Get current epoch (seconds):</b></p> 372<pre><code class="lua">epoch = os.time()</code></pre> 373 374<p><b>Convert epoch to human-readable date:</b></p> 375<pre><code class="lua">datestring = os.date('%c',1800000000)</code></pre> 376 377<h2 id="macos">macOS command</h2> 378 379<p><b>Get current epoch (seconds):</b></p> 380<pre><code class="bash">date -j</code></pre> 381 382<p><b>Convert epoch to human-readable date:</b></p> 383<pre><code class="bash">date -j -r 1800000000</code></pre> 384 385 386<h2 id="matlab">MATLAB routines</h2> 387 388<p><b>Convert epoch to human-readable date:</b></p> 389<pre><code class="plaintext">datestr(719529+TimeInSeconds/86400,'dd-mmm-yyyy HH:MM:SS')</code></pre> 390 391 392<h2 id="excel">Microsoft Excel / LibreOffice Calc</h2> 393 394<p><b>Convert epoch to human-readable date:</b></p> 395<pre><code class="plaintext">=(A1 / 86400) + 25569</code></pre> 396<p class="preline">Format the result cell for date/time, the result will be in GMT time. 397A1 is the cell with the epoch number.</p> 398<p>For other time zones:</p> 399<pre><code class="plaintext">=((A1 +/- [time zone adjustment]) / 86400) + 25569</code></pre> 400<p>Find the time zone adjustment in seconds for your local time on the <a href="/timezones">time zones list</a> page.</p> 401 402 403<h2 id="mojo">Mojo routines</h2> 404 405<p><b>Get current epoch (seconds):</b></p> 406<pre><code class="python">from sys.ffi import external_call 407 408fn main(): 409 var epoch = external_call["time", Int64](0) 410 print(epoch)</code></pre> 411 412 413<h2 id="nim">Nim routines</h2> 414 415<p><b>Get current epoch (seconds):</b></p> 416<pre><code class="python">import std/times 417getTime().toUnix()</code></pre> 418 419<p><b>Convert human-readable date to epoch:</b></p> 420<pre><code class="python">import std/times 421parse("2030-07-01 02:30:00", "yyyy-MM-dd HH:mm:ss", utc()).toTime().toUnix()</code></pre> 422 423<p><b>Convert epoch to human-readable date:</b></p> 424<pre><code class="python">import std/times 425fromUnix(1800000000).utc()</code></pre> 426 427 428<h2 id="objectivec">Objective-C routines</h2> 429 430<p><b>Get current epoch (seconds):</b></p> 431<pre><code class="objectivec">[[NSDate date] timeIntervalSince1970];</code></pre> 432<p>Returns a double. To get a string:</p> 433<pre><code class="objectivec">NSString *currentTimestamp = [NSString stringWithFormat:@"%f", [[NSDate date] timeIntervalSince1970]];</code></pre> 434 435<p><b>Convert epoch to human-readable date:</b></p> 436<pre><code class="objectivec">NSDate * myDate = [NSDate dateWithTimeIntervalSince1970:1800000000]; NSLog(@"%@", date);</code></pre> 437 438 439<h2 id="oraclesql">Oracle PL/SQL routines</h2> 440 441<p><b>Get current epoch (seconds):</b></p> 442<pre><code class="sql">SELECT (CAST(SYS_EXTRACT_UTC(SYSTIMESTAMP) AS DATE) - TO_DATE('01/01/1970','DD/MM/YYYY')) * 24 * 60 * 60 FROM DUAL;</code></pre> 443 444<p><b>Convert epoch to human-readable date:</b></p> 445<pre><code class="sql">SELECT to_date('01-JAN-1970','dd-mon-yyyy')+(1800000000/60/60/24) from dual</code></pre> 446<p>Replace 1526357743 with epoch.</p> 447 448 449<h2 id="postgresql">
449PostgreSQL routines</h2> 450 451<p><b>Get current epoch (seconds):</b></p> 452<pre><code class="sql">SELECT extract(epoch FROM now());</code></pre> 453 454<p><b>Convert human-readable date to epoch:</b></p> 455<pre><code class="sql">SELECT extract(epoch FROM date('2000-01-01 12:34'));</code></pre> 456<p>With timestamp:</p> 457<pre><code class="sql">SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE '2018-02-16 20:38:40-08');</code></pre> 458<p>With interval:</p> 459<pre><code class="sql">SELECT EXTRACT(EPOCH FROM INTERVAL '5 days 3 hours');</code></pre> 460 461<p><b>Convert epoch to human-readable date:</b></p> 462<p>PostgreSQL version 8.1 and higher:</p> 463<pre><code class="sql">SELECT to_timestamp(1800000000);</code></pre> 464<p>Older versions:</p> 465<pre><code class="sql">SELECT TIMESTAMP WITH TIME ZONE 'epoch' + 1800000000 * INTERVAL '1 second';</code></pre> 466 467 468<h2 id="powershell">PowerShell routines</h2> 469 470<p><b>Get current epoch (seconds):</b></p> 471<pre><code class="sh"> [DateTimeOffset]::Now.ToUnixTimeSeconds()</code></pre> 472<p>or:</p> 473<pre><code class="sh">[int][double]::Parse((Get-Date (get-date).touniversaltime() -UFormat %s))</code></pre> 474 475<p><b>Convert epoch to human-readable date:</b></p> 476 477<p>PowerShell 5.1+ (Windows 10+):</p> 478<pre><code class="sh"> [DateTimeOffset]::FromUnixTimeSeconds(1800000000).LocalDateTime</code></pre> 479 480<p>PowerShell Core (7.0+):</p> 481<pre><code class="sh">Get-Date -UnixTimeSeconds 1800000000</code></pre> 482 483<p>Version for all Windows PowerShell versions:</p> 484<pre><code class="sh">Function get-epochDate ($epochDate) { 485 [timezone]::CurrentTimeZone.ToLocalTime(([datetime]'1/1/1970').AddSeconds($epochDate)) } 486 487get-epochDate 1800000000 488</code></pre> 489 490 491 492<h2 id="python">Python routines</h2> 493 494<p><b>Get current epoch (seconds):</b></p> 495<pre><code class="python">import time; 496time.time()</code></pre> 497 498<p><b>Convert human-readable date to epoch:</b></p> 499<pre><code class="python">import calendar, time; 500calendar.timegm(time.strptime('2000-01-01 12:34:00', '%Y-%m-%d %H:%M:%S'))</code></pre> 501 502<p><b>Convert epoch to human-readable date:</b></p> 503<pre><code class="python">import time; time.ctime(1800000000)</code></pre> 504 505Or: 506 507<pre><code class="python">import time; 508time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.localtime(1800000000))</code></pre> 509<p>Replace <code>time.localtime</code> with <code>time.gmtime</code> for GMT time. Or using datetime:<br> 510<code>import datetime; 511datetime.datetime.utcfromtimestamp(epoch).replace(tzinfo=datetime.timezone.utc)</code></p> 512 513 514<h2 id="r">R routines</h2> 515 516<p><b>Get current epoch (seconds):</b></p> 517<pre><code class="r">as.numeric(Sys.time())</code></pre> 518 519<p><b>Convert human-readable date to epoch:</b></p> 520<pre><code class="r">as.numeric(as.POSIXct("YYYY-MM-dd HH:mm:ss", tz = "GMT", origin="1970-01-01"))</code></pre> 521<p>The origin parameter is optional.</p> 522 523<p><b>Convert epoch to human-readable date:</b></p> 524<pre><code class="r">as.POSIXct(epoch, origin="1970-01-01", tz="GMT")</code></pre> 525 526 527<h2 id="ruby">Ruby routines</h2> 528 529<p><b>Get current epoch (seconds):</b></p> 530<pre><code class="ruby">Time.now</code></pre> 531<p>(or <code>Time.new</code>). To display the epoch: <code>Time.now.to_i</code></p> 532 533<p><b>Convert human-readable date to epoch:</b></p> 534<pre><code class="ruby">Time.local(year, month, day, hour, minute, second, usec)</code></pre> 535<p>(or <code>Time.gm</code> for GMT/UTC input). To display add <code>.to_i</code></p> 536 537<p><b>Convert epoch to human-readable date:</b></p> 538<pre><code class="ruby">Time.at(epoch)</code></pre> 539 540<h2 id="rust">Rust routines</h2> 541<p><b>Get current epoch / convert human-readable date to epoch:</b></p> 542<pre><code class="rust">SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)</code></pre> 543<p><a rel="nofollow" target="_blank" class="external" href="https://doc.rust-lang.org/std/time/struct.SystemTime.html">SystemTime documentation</a></p> 544 545 546<h2 id="solidity">Solidity routines</h2> 547 548<p><b>Get current epoch (seconds):</b></p> 549<pre><code class="cpp">uint256 epoch = block.timestamp;</code></pre> 550 551 552<h2 id="sqlserver">SQL Server routines</h2> 553<p><b>Get current epoch (seconds):</b></p> 554<pre><code class="sql">SELECT DATEDIFF(s, '1970-01-01 00:00:00', GETUTCDATE());</code></pre> 555 556<p><b>Convert human-readable date to epoch:</b></p> 557<pre><code class="sql">SELECT DATEDIFF(s, '1970-01-01 00:00:00', 'time_field')</code></pre> 558 559<p><b>Convert epoch to human-readable date:</b></p> 560<pre><code class="sql">SELECT DATEADD(s, 1800000000, '1970-01-01 00:00:00');</code></pre> 561<p>Replace s with ms if the epoch is in milliseconds.</p> 562 563<h2 id="sqlite">SQLite routines</h2> 564 565<p><b>Get current epoch (seconds):</b></p> 566<pre><code class="sql">SELECT unixepoch(); 567SELECT strftime('%s', 'now');</code></pre> 568 569<p><b>Convert human-readable date to epoch:</b></p> 570<pre><code class="sql">SELECT strftime('%s', 'timestring');</code></pre> 571 572<p><b>Convert epoch to human-readable date:</b></p> 573<pre><code class="sql">SELECT datetime(1800000000, 'unixepoch');</code></pre> 574<p>Or local time zone:</p> 575<pre><code class="sql">SELECT datetime(1800000000, 'unixepoch', 'localtime');</code></pre> 576 577 578<h2 id="swift">Swift routines</h2> 579 580<p><b>Get current epoch (seconds):</b></p> 581<pre><code class="swift">Int(Date().timeIntervalSince1970)</code></pre> 582 583<p><b>Convert human-readable date to epoch:</b></p> 584<pre><code class="swift">let formatter = DateFormatter() 585formatter.dateFormat = "yyyy-MM-dd HH:mm:ss" 586formatter.timeZone = TimeZone(abbreviation: "UTC") 587if let date = formatter.date(from: "2030-07-01 02:30:00") { 588 let epoch = Int(date.timeIntervalSince1970) 589}</code></pre> 590 591<p><b>Convert epoch to human-readable date:</b></p> 592<pre><code class="swift">let date = Date(timeIntervalSince1970: 1800000000)</code></pre> 593 594 595<h2 id="tcltk">Tcl/Tk routines</h2> 596 597<p><b>Get current epoch (seconds):</b></p> 598<pre><code class="sh">clock seconds</code></pre> 599 600<p><b>Convert epoch to human-readable date:</b></p> 601<pre><code class="sh">clock format 1800000000</code></pre> 602 603<p>See <a rel="nofollow" target="_blank" class="external" href="https://www.tcl.tk/man/tcl8.6/TclCmd/clock.htm">Tcl/Tk clock documentation</a> for more details.</p> 604 605 606<h2 id="unixshell">Unix/Linux Shell (Bash) commands</h2> 607 608<p><b>Get current epoch (seconds):</b></p> 609<pre><code class="bash">date +%s</code></pre> 610 611<p><b>In zsh, using the datetime module:</b></p> 612<pre><code class="bash">zmodload zsh/datetime 613echo $EPOCHSECONDS</code></pre> 614 615<p><b>Convert human-readable date to epoch:</b></p> 616<pre><code class="bash">date +%s -d"Jan 1, 1980 00:00:01"</code></pre> 617<p>Replace '-d' with '-ud' to input in GMT/UTC time.</p> 618 619<p><b>Convert epoch to human-readable date:</b></p> 620<pre><code class="bash">date -d @1800000000</code></pre> 621<p>Replace 1800000000 with your epoch, needs recent version of 'date'. Replace '-d' with '-ud' for GMT/UTC time.</p> 622 623 624<h2 id="zig">Zig routines</h2> 625 626<p><b>Get current epoch (seconds):</b></p> 627<pre><code class="cpp">const std = @import("std"); 628const epoch = std.time.timestamp();</code></pre> 629 630 631<!-- LEGACY / END OF LIFE LANGUAGES --> 632 <p> </p> 633<h1>Legacy / EOL</h1> 634 635<h2 id="coldfusion">
635Adobe ColdFusion routines</h2> 636 637<p><b>Get current epoch (seconds):</b></p> 638<pre><code class="xml"><cfset epochTime = left(getTickcount(), 10)></code></pre> 639 640<p><b>Convert human-readable date to epoch:</b></p> 641<pre><code class="plaintext">int(parseDateTime(datetime).getTime()/1000);</code></pre> 642 643<p><b>Convert epoch to human-readable date:</b></p> 644<pre><code class="plaintext">DateAdd("s",epoch,"1/1/1970");</code></pre> 645 646 647<h2 id="asp">ASP / VBScript routines</h2> 648 649<p><b>Warning!</b> You need to correct the time zone for these examples to work.</p> 650 651<p>A manual quick fix is to either:</p> 652<ul><li>look up the offset in wmi and add it to Now()</li> 653<li>change the "01/01/1970 00:00:00" string, for example for GMT/UTC+1 = "01/01/1970 01:00:00"</li></ul> 654<p>The current Unix time:</p> 655 656<pre><code class="vbnet">' check time zone 657DateDiff("s", "01/01/1970 00:00:00", Now()) 658</code></pre> 659 660<p>Current Unix time with time zone fix:</p> 661<pre><code class="vbnet">function date2epoch(myDate) 662Set dateTime = CreateObject("WbemScripting.SWbemDateTime") 663dateTime.SetVarDate (myDate) 664DateDiff("s", "01/01/1970 00:00:00", CDate(dateTime.GetVarDate (false))) 665end function 666 667Wscript.echo date2epoch(Now())</code></pre> 668 669<p><b>date2epoch converts a VBScript date to a Unix timestamp:</b></p> 670 671<pre><code class="vbnet">' check time zone if your date is not GMT/UTC 672function date2epoch(myDate) 673date2epoch = DateDiff("s", "01/01/1970 00:00:00", myDate) 674end function 675</code></pre> 676 677<p>Usage example:</p><pre class="javascriptCode">date2epoch(Now())</pre> 678 679<p><b>epoch2date converts Unix timestamps back to VBScript dates:</b></p> 680 681<pre><code class="vbnet">' result is GMT/UTC 682function epoch2date(myEpoch) 683epoch2date = DateAdd("s", myEpoch, "01/01/1970 00:00:00") 684end function 685</code></pre> 686 687 688<h2 id="crystalreports">Crystal Reports routines</h2> 689 690<p><b>Convert epoch to human-readable date:</b></p> 691<pre><code class="vbnet">DateAdd("s", {EpochTimeStampField}-14400, #1/1/1970 00:00:00#)</code></pre> 692<p>-14400 used for Eastern Standard Time. See <a href="/timezones">Time Zones</a>.</p> 693 694<h2 id="ibminformix">IBM Informix routines</h2> 695 696<p><b>Get current epoch (seconds):</b></p> 697<pre><code class="sql">SELECT dbinfo('utc_current') FROM sysmaster:sysdual;</code></pre> 698 699<p><b>Convert epoch to human-readable date:</b></p> 700<pre><code class="sql">SELECT dbinfo('utc_to_datetime',1800000000) FROM sysmaster:sysdual;</code></pre> 701 702<h2 id="ibmpuredata">IBM PureData System for Analytics routines</h2> 703 704<p><b>Convert epoch to human-readable date:</b></p> 705<pre><code class="sql">select 996673954::int4::abstime::timestamp;</code></pre> 706 707<h2 id="solaris">Solaris (OS commands)</h2> 708 709<p><b>Get current epoch (seconds):</b></p> 710<pre><code class="sh">/usr/bin/nawk 'BEGIN {print srand()}'</code></pre> 711<p>Solaris doesn't support <i>date +%s</i>, but the default seed value for nawk's random-number generator is the number of seconds since the epoch.</p> 712 713<h2 id="visualfoxpro">Visual FoxPro routines</h2> 714 715<p><b>Get current epoch (seconds):</b></p> 716<pre><code class="vbnet">DATETIME() - {^1970/01/01 00:00:00}</code></pre> 717 718<p><i>Warning:</i> time zones may not be handled correctly by Visual FoxPro.</p> 719 720 721<br> 722<p>Thanks to everyone who sent corrections and updates!</p> 723 724</div> 725</div> 726</main> 727 728<div id="jqlocr"></div> 729<aside id="rightcolumn" aria-label="Site menu" tabindex="-1"> 730<button type="button" class="close" aria-label="Close"></button> 731<nav class="innertube" aria-labelledby="sidebar-title"> 732 733<h2 id="sidebar-title">Pages</h2> 734 735<div class="sub firstsub"> 736 737<div class="menu" id="menu-epochtools"> 738<h3>Unix time / epoch <i class="fa fa-angle-up" aria-hidden="true"></i></h3><div class="links"> 739<a href="/">Home</a><br> 740<a href="/batch">Batch converter</a><br> 741<a href="/timezones">Time zone converter</a><br> 742<a href="/timestamp-list">Timestamp list</a><br> 743<a href="/calendar/2026">Calendar with timestamps</a><br> 744<a href="/hex" title="seconds since 1970">Unix hex timestamp</a><br> 745<a href="/year-2038-problem">Year 2038 problem</a><br> 746<a href="/countdown">Countdown in seconds</a><br> 747<a href="/clock">Epoch clock</a> 748</div></div> 749 750<div class="menu" id="menu-converters"> 751<h3>Other converters <i class="fa fa-angle-up" aria-hidden="true"></i></h3><div class="links"> 752<a href="/ldap" title="100-nanosecond intervals since 1601">LDAP timestamp</a><br> 753<a href="/dotnet" title="100-ns intervals since year 1">.NET DateTime ticks</a><br> 754<a href="/snowflake">Snowflake ID (Discord/X)</a><br> 755<a href="/tid">Bluesky/AT Protocol TID</a><br> 756<a href="/uuid">UUID/ULID timestamp</a><br> 757<a href="/gps" title="seconds, weeks since Jan. 6, 1980">GPS time converter</a><br> 758<a href="/webkit" title="microseconds since 1601">Chrome/WebKit timestamp</a><br> 759<a href="/coredata" title="seconds since 2001">Cocoa Core Data timestamp</a><br> 760<a href="/mac" title="seconds since 1904">Mac HFS+ timestamp</a><br> 761<a href="/ntp" title="seconds since 1900">NTP timestamp</a><br> 762<a href="/fat" title="seconds since 1980/2000">FAT timestamp</a><br> 763<a href="/sas" title="seconds, days since 1960">SAS timestamp</a><br> 764<a href="/excel-oadate" title="days since 1900">Excel OADate timestamp</a><br> 765<a href="/seconds-days-since-y0" title="days since Y0,1,1900,1904,1970, seconds since Y0,1">Seconds/days since year 0</a><br> 766<a href="/duration">ISO duration converter</a><br> 767<a href="/numbers/bin-oct-dec-hex">Bin/Oct/Hex converter</a><br> 768<a href="/julian-day" title="JD, MJD, JDN converter">Julian Day converter</a><br> 769</div></div> 770 771<div class="menu" id="menu-datetime"> 772<h3>Date and time <i class="fa fa-angle-up" aria-hidden="true"></i></h3><div class="links"> 773<a href="/weeknumbers">Week number</a><br> 774<a href="/weeks/2026">Week numbers 2026</a><br> 775<a href="/daynumbers">Day number</a><br> 776<a href="/days/2026">Day numbers 2026</a><br> 777<a href="/world-clock">World clock</a><br> 778<a href="/years">Years and leap years</a><br> 779<a href="/lunar-phases/2026">Lunar phases</a><br> 780<a href="/date-calculator">Date calculator</a><br> 781<a href="/date-difference">Calculate the difference<br> between two dates</a><br> 782</div></div> 783 784</div><div class="sub lastsub"> 785 786<div class="menu" id="menu-prg"> 787<h3>Programming <i class="fa fa-angle-up" aria-hidden="true"></i></h3><div class="links"> 788<a href="/programming/">Code snippets A-Z</a><br> 789<a href="/programming/c">Epoch in C</a><br> 790<a href="/programming/mysql">Epoch in MySQL</a><br> 791<a href="/programming/perl">Epoch in PERL</a><br> 792<a href="/programming/php">Epoch in PHP</a> 793</div></div> 794 795 796<div class="menu menu-closed" id="menu-more"> 797<h3>More <i class="fa fa-angle-down" aria-hidden="true"></i></h3><div class="links"> 798<a href="/comments">Comments & questions</a><br> 799<a lang="es" href="//espanol.epochconverter.com/">Este sitio en Español</a><br> 800<a target="_blank" class="external" href="https://www.charset.org/">Charset Tools</a> 801</div></div> 802</div><br> 803 804</nav> 805</aside> 806 807<footer id="footer" role="contentinfo"> 808 809<div class="google-anno-skip"><nav class="footer-links"><a href="/">Home</a> - <a href="/site/sitemap">Sitemap</a> - <a href="/site/privacy-policy">Privacy</a> - <a href="/site/disclaimer">Disclaimer</a> - <a href="/site/contact">Contact</a></nav><div class="footer-copy"><bdi>© 2026 <a class="nocolor" href="https://www.epochconverter.com">Epoch Converter</a> by <a class="nocolor" href="https://misja.com/">Misja.com</a></bdi></div></div> 810 811<div class="topbtn"><a href="#top" class="jumptotop"><i class="fa fa-arrow-up fa-fw fa-lg fa-border" aria-hidden="true"></i><span class="sr-only">Jump to top</span></a></div> 812</footer> 813</div> 814 815 <div id="settingspanel" aria-hidden="true" role="dialog" aria-labelledby="settingspanel-title" google-side-rail-
815overlap="false"> 816 <button type="button" class="settings-close" aria-label="Close"></button> 817 <div class="innertube"> 818 <h2 id="settingspanel-title">Preferences</h2> 819 820 <fieldset class="settings-radios" aria-labelledby="settingspanel-title"> 821 <label for="settings-locale">Regional format</label> 822 <select id="settings-locale" name="settings_ec_locale" data-locale-options="["af","sq","ar","hy-am","az","bm","eu","be","bn","bs","br","bg","my","km","ca","tzm","zh-cn","zh-hk","zh-tw","cv","hr","cs","da","nl","en-au","en-ca","en-gb","en-ie","en-us","eo","et","fo","fi","fr","fr-ca","fy","gl","ka","de","el","gu","he","hi","hu","is","id","it","ja","jv","kn","kk","ko","ku","ky","lo","lv","lt","lb","mk","ms","ml","mt","mi","mr","mn","ne","se","nb","nn","fa","pl","pt","pt-br","pa-in","ro","ru","gd","sr","sd","si","sk","sl","es","es-do","sw","sv","tg","ta","te","th","bo","tr","uk","ur","uz","vi","cy","yo"]"> 823 <option value="0">Autodetect</option> 824 <option value="en-us">English (US, MDY-format, 12h clock)</option> 825 <option value="en-gb">English (UK, DMY-format, 24h clock)</option> 826 <option disabled></option> 827 </select> 828 829 <div style="margin-top:12px; margin-bottom:4px;"> 830 <div style="margin-bottom:5px;">Clock</div> 831 <div id="pref-clockf-group" class="cal-toggle-group" role="group" aria-label="Clock"> 832 <button type="button" class="cal-toggle" data-val="12">12-hour</button><button type="button" class="cal-toggle" data-val="24">24-hour</button> 833 </div> 834 </div> 835 <div id="settings-translate-group" style="margin-top:12px; margin-bottom:4px;"> 836 <div style="margin-bottom:5px;">Translate dates</div> 837 <div id="pref-gmt-local-group" class="cal-toggle-group" role="group" aria-label="Translate local language"> 838 <button type="button" class="cal-toggle" data-val="1">Local + UTC</button><button type="button" class="cal-toggle" data-val="0">Only local</button> 839 </div> 840 </div> 841 842 843 844 845 </fieldset> 846 <br><a href="#" id="settings-restore-btn" onclick="return prefsClearPanel()">Restore defaults</a> 847 </div> 848 </div> 849
850<script type="application/ld+json"> 851{"@context":"https://schema.org","@type":"BreadcrumbList","itemListElement":[{"@type":"ListItem","position":1,"name":"Epoch Converter","item":"https://www.epochconverter.com/"},{"@type":"ListItem","position":2,"name":"Epoch / Unix timestamp functions","item":"https://www.epochconverter.com/programming/"}]}</script>
vendor: 1 bytes, line 851
851
852<script src="/js/epoch.min.js?v=115"></script>
852<script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.12.0/highlight.min.js" integrity="sha512-gzqHAlI1hVdzJ4wiQj/MkppDr6zgEdCoBsrXKRidcaZsSPvNQ3Fy5p7PpMt/8mltxTxMHj1Ur5NWbJdqIfpxgA==" crossorigin="anonymous" referrerpolicy="no-referrer"></script>
852<script>document.addEventListener("DOMContentLoaded", function(){ if(window.hljs){window.hljs.configure({languages:[]});document.querySelectorAll("pre code").forEach(function(el){try{window.hljs.highlightElement(el);}catch(e){}});} });</script>
852</body> 853</html>
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.