<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Unix timestamp Archives - scmGalaxy</title>
	<atom:link href="https://www.scmgalaxy.com/tutorials/tag/unix-timestamp/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.scmgalaxy.com/tutorials/tag/unix-timestamp/</link>
	<description>A Platform for Software Engineers</description>
	<lastBuildDate>Sat, 27 Feb 2021 09:52:53 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.1</generator>
	<item>
		<title>How to Understand Epoch &#038; Unix Timestamp &#124; Epoch Converter</title>
		<link>https://www.scmgalaxy.com/tutorials/understanding-epoch-unix-timestamp/</link>
					<comments>https://www.scmgalaxy.com/tutorials/understanding-epoch-unix-timestamp/#comments</comments>
		
		<dc:creator><![CDATA[scmgalaxy K]]></dc:creator>
		<pubDate>Wed, 22 Feb 2012 00:00:00 +0000</pubDate>
				<category><![CDATA[Concept & Definition]]></category>
		<category><![CDATA[About Epoch Timestamp]]></category>
		<category><![CDATA[About Unix Timestamp]]></category>
		<category><![CDATA[Epoch]]></category>
		<category><![CDATA[Epoch and Unix]]></category>
		<category><![CDATA[Epoch Converter]]></category>
		<category><![CDATA[Epoch time]]></category>
		<category><![CDATA[Introduction Epoch Timestamp]]></category>
		<category><![CDATA[Introduction Unix Timestamp]]></category>
		<category><![CDATA[Overview Epoch & Unix Timestamp]]></category>
		<category><![CDATA[Timestamp]]></category>
		<category><![CDATA[Understand]]></category>
		<category><![CDATA[Understand Epoch & Unix Timestamp]]></category>
		<category><![CDATA[unix]]></category>
		<category><![CDATA[Unix timestamp]]></category>
		<category><![CDATA[What is epoch time]]></category>
		<category><![CDATA[What is unix time]]></category>
		<guid isPermaLink="false">http://www.scmgalaxy.com/tutorials/2012/02/22/understanding-epoch-unix-timestamp/</guid>

					<description><![CDATA[<p>What is epoch time? The Unix epoch (or Unix time or POSIX time or Unix timestamp) is the number of [&#8230;]</p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/understanding-epoch-unix-timestamp/">How to Understand Epoch &#038; Unix Timestamp | Epoch Converter</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-3849 aligncenter" src="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2012/02/epoch-unix-timestamp.png" alt="epoch-unix-timestamp" width="600" height="400" srcset="https://www.scmgalaxy.com/tutorials/wp-content/uploads/2012/02/epoch-unix-timestamp.png 600w, https://www.scmgalaxy.com/tutorials/wp-content/uploads/2012/02/epoch-unix-timestamp-300x200.png 300w" sizes="(max-width: 600px) 100vw, 600px" /></h2>
<h2>What is epoch time?</h2>
<p>The <strong>Unix epoch</strong> (or <strong>Unix time</strong> or <strong>POSIX time</strong> or <strong>Unix timestamp</strong>) is the number of seconds that have elapsed since January 1, 1970 (midnight UTC/GMT), not counting leap seconds (in ISO 8601: 1970-01-01T00:00:00Z). Literally speaking the epoch is Unix time 0 (midnight 1/1/1970), but &#8216;epoch&#8217; is often used as a synonym for &#8216;Unix time&#8217;. Many Unix systems store epoch dates as a signed 32-bit integer, which might cause problems on January 19, 2038 (known as the Year 2038 problem or Y2038).</p>
<table border="1">
<tbody>
<tr>
<td><strong>Human readable time</strong></td>
<td align="right"><strong>Seconds</strong></td>
</tr>
<tr>
<td>1 hour</td>
<td align="right">3600 seconds</td>
</tr>
<tr>
<td>1 day</td>
<td align="right">86400 seconds</td>
</tr>
<tr>
<td>1 week</td>
<td align="right">604800 seconds</td>
</tr>
<tr>
<td>1 month (30.44 days)</td>
<td align="right">2629743 seconds</td>
</tr>
<tr>
<td>1 year (365.24 days)</td>
<td align="right">31556926 seconds</td>
</tr>
</tbody>
</table>
<h2>How to get the current epoch time in &#8230;</h2>
<table border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td><strong>Perl</strong></td>
<td>time</td>
</tr>
<tr>
<td><strong>PHP</strong></td>
<td>time()</td>
</tr>
<tr>
<td><strong>Ruby</strong></td>
<td>Time.now (or Time.new). To display the epoch: Time.now.to_i</td>
</tr>
<tr>
<td><strong>Python</strong></td>
<td>import time first, then time.time()</td>
</tr>
<tr>
<td><strong>Java</strong></td>
<td>long epoch = System.currentTimeMillis()/1000;</td>
</tr>
<tr>
<td><strong>Microsoft .NET C#</strong></td>
<td>epoch = (DateTime.Now.ToUniversalTime().Ticks &#8211; 621355968000000000) / 10000000;</td>
</tr>
<tr>
<td><strong>VBScript/ASP</strong></td>
<td>DateDiff(&#8220;s&#8221;, &#8220;01/01/1970 00:00:00&#8221;, Now())</td>
</tr>
<tr>
<td><strong>R</strong></td>
<td>as.numeric(Sys.time())</td>
</tr>
<tr>
<td><strong>Erlang</strong></td>
<td>calendar:datetime_to_gregorian_seconds(calendar:now_to_universal_time( now()))-719528*24*3600.</td>
</tr>
<tr>
<td><strong>MySQL</strong></td>
<td>SELECT unix_timestamp(now()) <a href="http://www.epochconverter.com/programming/mysql-from-unixtime.php">More info (+ negative epochs)</a></td>
</tr>
<tr>
<td><strong>PostgreSQL</strong></td>
<td>SELECT extract(epoch FROM now());</td>
</tr>
<tr>
<td><strong>Oracle PL/SQL</strong></td>
<td>SELECT (SYSDATE &#8211; TO_DATE(&#8217;01/01/1970 00:00:00&#8242;, &#8216;MM-DD-YYYY HH24:MI:SS&#8217;)) *<br />
24 * 60 * 60 FROM DUAL</td>
</tr>
<tr>
<td><strong>SQL Server</strong></td>
<td>SELECT DATEDIFF(s, &#8216;1970-01-01 00:00:00&#8217;, GETUTCDATE())</td>
</tr>
<tr>
<td><strong>JavaScript</strong></td>
<td>Math.round(new Date().getTime()/1000.0) getTime() returns time in milliseconds.</td>
</tr>
<tr>
<td><strong>Tcl/Tk</strong></td>
<td>clock seconds</td>
</tr>
<tr>
<td><strong>Unix/Linux Shell</strong></td>
<td>date +%s</td>
</tr>
<tr>
<td><strong>PowerShell</strong></td>
<td>Get-Date -UFormat &#8220;%s&#8221; Produces: 1279152364.63599</td>
</tr>
<tr>
<td><strong>Other OS&#8217;s </strong></td>
<td>Command line: perl -e &#8220;print time&#8221; (If Perl is installed on your system)</td>
</tr>
</tbody>
</table>
<h2>Convert from human readable date to epoch</h2>
<table border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td><strong>Perl</strong></td>
<td>Use the <a href="http://www.epochconverter.com/programming/functions-perl.php">Perl Epoch routines</a></td>
</tr>
<tr>
<td><strong>PHP</strong></td>
<td>mktime(<em>hour</em>, <em>minute</em>, <em>second</em>, <em>month</em>, <em>day</em>, <em>year</em>) <a href="http://www.php.net/mktime" rel="nofollow"><img decoding="async" src="http://www.epochconverter.com/img/icons/info.png" alt="More info" width="16" height="16" border="0" /></a></td>
</tr>
<tr>
<td><strong>Ruby</strong></td>
<td>Time.local(<em>year</em>, <em>month</em>, <em>day</em>, <em>hour</em>, <em>minute</em>, <em>second</em>, <em>usec</em> ) (or Time.gm for GMT/UTC input). To display add .to_i</td>
</tr>
<tr>
<td><strong>Python</strong></td>
<td>import time first, then int(time.mktime(time.strptime(&#8216;2000-01-01 12:34:00&#8217;, &#8216;%Y-%m-%d %H:%M:%S&#8217;))) &#8211; time.timezone</td>
</tr>
<tr>
<td><strong>Java</strong></td>
<td>long epoch = new java.text.SimpleDateFormat (&#8220;MM/dd/yyyy HH:mm:ss&#8221;).parse(&#8220;01/01/1970 01:00:00&#8221;).getTime();</td>
</tr>
<tr>
<td><strong>VBScript/ASP</strong></td>
<td>DateDiff(&#8220;s&#8221;, &#8220;01/01/1970 00:00:00&#8221;, <em>time field</em>) <a href="http://www.epochconverter.com/programming/#asp"><img decoding="async" src="http://www.epochconverter.com/img/icons/info.png" alt="More info" width="16" height="16" border="0" /></a></td>
</tr>
<tr>
<td><strong>C</strong></td>
<td>Use the <a href="http://www.epochconverter.com/programming/functions-c.php">C Epoch Converter routines</a></td>
</tr>
<tr>
<td><strong>R</strong></td>
<td>as.numeric(as.POSIXct(&#8220;MM/dd/yyyy HH:mm:ss&#8221;, origin=&#8221;1970-01-01&#8243;))</td>
</tr>
<tr>
<td><strong>MySQL</strong></td>
<td>SELECT unix_timestamp(<em>time</em>) Time format: YYYY-MM-DD HH:MM:SS or YYMMDD or YYYYMMDD<br />
<a href="http://www.epochconverter.com/programming/mysql-from-unixtime.php">More on using Epoch timestamps with MySQL</a></td>
</tr>
<tr>
<td><strong>PostgreSQL</strong></td>
<td>SELECT extract(epoch FROM date(&#8216;2000-01-01 12:34&#8217;));<br />
With timestamp: SELECT EXTRACT(EPOCH FROM TIMESTAMP WITH TIME ZONE &#8216;2001-02-16 20:38:40-08&#8217;);<br />
With interval: SELECT EXTRACT(EPOCH FROM INTERVAL &#8216;5 days 3 hours&#8217;);</td>
</tr>
<tr>
<td><strong>SQL Server</strong></td>
<td>SELECT DATEDIFF(s, &#8216;1970-01-01 00:00:00&#8217;, <em>time field</em>)</td>
</tr>
<tr>
<td><strong>JavaScript</strong></td>
<td>Use the <a href="http://www.epochconverter.com/programming/#javascript">JavaScript Date object</a></td>
</tr>
<tr>
<td><strong>Unix/Linux Shell</strong></td>
<td>date +%s -d&#8221;Jan 1, 1980 00:00:01&#8243; Replace &#8216;-d&#8217; with &#8216;-ud&#8217; to input in GMT/UTC time.</td>
</tr>
</tbody>
</table>
<h2>Convert from epoch to human readable date</h2>
<table border="0" cellspacing="0" cellpadding="2">
<tbody>
<tr>
<td><strong>Perl</strong></td>
<td>Use the <a href="http://www.epochconverter.com/programming/functions-perl.php">Perl Epoch routines</a></td>
</tr>
<tr>
<td><strong>PHP</strong></td>
<td>date(<em>output format</em>, <em>epoch</em>); Output format example: &#8216;r&#8217; = RFC 2822 date <a href="http://nl2.php.net/date" rel="nofollow"><img decoding="async" src="http://www.epochconverter.com/img/icons/info.png" alt="More info" width="16" height="16" border="0" /></a></td>
</tr>
<tr>
<td><strong>Ruby</strong></td>
<td>Time.at(<em>epoch</em>)</td>
</tr>
<tr>
<td><strong>Python</strong></td>
<td>import time first, then time.strftime(&#8220;%a, %d %b %Y %H:%M:%S +0000&#8221;, time.localtime(<em>epoch</em>)) Replace time.localtime with time.gmtime for GMT time. <a href="http://docs.python.org/lib/module-time.html" rel="nofollow"><img decoding="async" src="http://www.epochconverter.com/img/icons/info.png" alt="More info" width="16" height="16" border="0" /></a></td>
</tr>
<tr>
<td><strong>Java</strong></td>
<td>String date = new java.text.SimpleDateFormat(&#8220;MM/dd/yyyy HH:mm:ss&#8221;).format(new java.util.Date (<em>epoch</em>*1000));</td>
</tr>
<tr>
<td><strong>VBScript/ASP</strong></td>
<td>DateAdd(&#8220;s&#8221;, <em>epoch</em>, &#8220;01/01/1970 00:00:00&#8221;) <a href="http://www.epochconverter.com/programming/#asp"><img decoding="async" src="http://www.epochconverter.com/img/icons/info.png" alt="More info" width="16" height="16" border="0" /></a></td>
</tr>
<tr>
<td><strong>C</strong></td>
<td>Use the <a href="http://www.epochconverter.com/programming/functions-c.php">C Epoch Converter routines</a></td>
</tr>
<tr>
<td><strong>R</strong></td>
<td>as.POSIXct(epoch, origin=&#8221;1970-01-01&#8243;)</td>
</tr>
<tr>
<td><strong>MySQL</strong></td>
<td>from_unixtime(<em>epoch</em>, <em>optional output format</em>) The default output format is YYY-MM-DD HH:MM:SS <a href="http://www.epochconverter.com/programming/mysql-from-unixtime.php">more &#8230;</a></td>
</tr>
<tr>
<td><strong>PostgreSQL</strong></td>
<td>PostgreSQL version 8.1 and higher: SELECT to_timestamp(<em>epoch</em>); <a href="http://www.postgresql.org/docs/8.1/static/functions-formatting.html" rel="nofollow"><img decoding="async" src="http://www.epochconverter.com/img/icons/info.png" alt="More info" width="16" height="16" border="0" /></a> Older versions: SELECT TIMESTAMP WITH TIME ZONE &#8216;epoch&#8217; + <em>epoch</em> * INTERVAL &#8216;1 second&#8217;;</td>
</tr>
<tr>
<td><strong>Oracle PL/SQL</strong></td>
<td>SELECT to_date(&#8217;01-JAN-1970&#8242;,&#8217;dd-mon-yyyy&#8217;)+(1326357743/60/60/24) from dual<br />
Replace 1326357743 with epoch.</td>
</tr>
<tr>
<td><strong>SQL Server</strong></td>
<td>DATEADD(s, <em>epoch</em>, &#8216;1970-01-01 00:00:00&#8217;)</td>
</tr>
<tr>
<td><strong>Microsoft Excel</strong></td>
<td>=(A1 / 86400) + 25569 Format the result cell for date/time, the result will be in GMT time (A1 is the cell with the epoch number). For other time zones: =((A1 +/- <a href="http://www.epochconverter.com/epoch/timezones.php">time zone adjustment</a>) / 86400) + 25569.</td>
</tr>
<tr>
<td><strong>Crystal Reports</strong></td>
<td>DateAdd(&#8220;s&#8221;, {EpochTimeStampField}-14400, #1/1/1970 00:00:00#) -14400 used for Eastern Standard Time. See <a href="http://www.epochconverter.com/epoch/timezones.php">Time Zones</a>.</td>
</tr>
<tr>
<td><strong>JavaScript</strong></td>
<td>Use the <a href="http://www.epochconverter.com/programming/#javascript">JavaScript Date object</a></td>
</tr>
<tr>
<td><strong>Tcl/Tk</strong></td>
<td>clock format 1325376000 <a href="http://www.tcl.tk/man/tcl8.4/TclCmd/clock.htm" rel="nofollow"><img decoding="async" src="http://www.epochconverter.com/img/icons/info.png" alt="More info" width="16" height="16" border="0" /></a></td>
</tr>
<tr>
<td><strong>Unix/Linux Shell</strong></td>
<td>date -d @1190000000 Replace 1190000000 with your epoch, needs recent version of &#8216;date&#8217;. Replace &#8216;-d&#8217; with &#8216;-ud&#8217; for GMT/UTC time.</td>
</tr>
<tr>
<td><strong>PowerShell</strong></td>
<td>Function get-epochDate ($epochDate) { [timezone]::CurrentTimeZone.ToLocalTime(([datetime]&#8217;1/1/1970&#8242;).AddSeconds($epochDate)) }, then use: get-epochDate 1279152364. Works for Windows PowerShell v1 and v2</td>
</tr>
<tr>
<td><strong>Other OS&#8217;s</strong></td>
<td>Command line: perl -e &#8220;print scalar(localtime(<em>epoch</em>))&#8221; (If Perl is installed) Replace &#8216;localtime&#8217; with &#8216;gmtime&#8217; for GMT/UTC time.</td>
</tr>
</tbody>
</table>
<p><strong>Reference</strong></p>
<p><a href="http://www.epochconverter.com/" target="_blank" rel="noopener">http://www.epochconverter.com/</a></p>
<p>The post <a href="https://www.scmgalaxy.com/tutorials/understanding-epoch-unix-timestamp/">How to Understand Epoch &#038; Unix Timestamp | Epoch Converter</a> appeared first on <a href="https://www.scmgalaxy.com/tutorials">scmGalaxy</a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.scmgalaxy.com/tutorials/understanding-epoch-unix-timestamp/feed/</wfw:commentRss>
			<slash:comments>1</slash:comments>
		
		
			</item>
	</channel>
</rss>
