Sophie

Sophie

distrib > Mageia > 4 > x86_64 > by-pkgid > f800694edefe91adea2624f711a41a2d > files > 1305

php-manual-en-5.5.7-1.mga4.noarch.rpm

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
 <head>
  <meta http-equiv="content-type" content="text/html; charset=UTF-8">
  <title>Gets the Unix timestamp</title>

 </head>
 <body><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="datetime.getoffset.html">DateTime::getOffset</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="datetime.gettimezone.html">DateTime::getTimezone</a></div>
 <div class="up"><a href="class.datetimeinterface.html">DateTimeInterface</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div><hr /><div id="datetime.gettimestamp" class="refentry">
 <div class="refnamediv">
  <h1 class="refname">DateTime::getTimestamp</h1>
  <h1 class="refname">DateTimeImmutable::getTimestamp</h1>
  <h1 class="refname">DateTimeInterface::getTimestamp</h1>
  <h1 class="refname">date_timestamp_get</h1>
  <p class="verinfo">(PHP 5 &gt;= 5.3.0)</p><p class="refpurpose"><span class="refname">DateTime::getTimestamp</span> -- <span class="refname">DateTimeImmutable::getTimestamp</span> -- <span class="refname">DateTimeInterface::getTimestamp</span> -- <span class="refname">date_timestamp_get</span> &mdash; <span class="dc-title">Gets the Unix timestamp</span></p>

 </div>

 <div class="refsect1 description" id="refsect1-datetime.gettimestamp-description">
  <h3 class="title">Description</h3>
  <p class="para">Object oriented style</p>
  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><strong>DateTime::getTimestamp</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><strong>DateTimeImmutable::getTimestamp</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <div class="methodsynopsis dc-description">
   <span class="modifier">public</span> <span class="type">int</span> <span class="methodname"><strong>DateTimeInterface::getTimestamp</strong></span>
    ( <span class="methodparam">void</span>
   )</div>

  <p class="para rdfs-comment">Procedural style</p>
  <div class="methodsynopsis dc-description">
   <span class="type">int</span> <span class="methodname"><a href="function.date-timestamp-get.html" class="methodname">date_timestamp_get</a></span>
    ( <span class="methodparam"><span class="type"><a href="class.datetimeinterface.html" class="type DateTimeInterface">DateTimeInterface</a></span> <code class="parameter">$object</code></span>
   )</div>

  <p class="para rdfs-comment">
   Gets the Unix timestamp.
  </p>
 </div>


 <div class="refsect1 parameters" id="refsect1-datetime.gettimestamp-parameters">
  <h3 class="title">Parameters</h3>
  <p class="para">This function has no parameters.</p>
 </div>


 <div class="refsect1 returnvalues" id="refsect1-datetime.gettimestamp-returnvalues">
  <h3 class="title">Return Values</h3>
  <p class="para">
   Returns the Unix timestamp representing the date.
  </p>
 </div>


 <div class="refsect1 examples" id="refsect1-datetime.gettimestamp-examples">
  <h3 class="title">Examples</h3>
  <div class="example" id="example-2277">
   <p><strong>Example #1  <span class="function"><strong>DateTime::getTimestamp()</strong></span> example</strong></p>
   <div class="example-contents"><p>Object oriented style</p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$date&nbsp;</span><span style="color: #007700">=&nbsp;new&nbsp;</span><span style="color: #0000BB">DateTime</span><span style="color: #007700">();<br />echo&nbsp;</span><span style="color: #0000BB">$date</span><span style="color: #007700">-&gt;</span><span style="color: #0000BB">getTimestamp</span><span style="color: #007700">();<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>Procedural style</p></div>
   <div class="example-contents">
<div class="phpcode"><code><span style="color: #000000">
<span style="color: #0000BB">&lt;?php<br />$date&nbsp;</span><span style="color: #007700">=&nbsp;</span><span style="color: #0000BB">date_create</span><span style="color: #007700">();<br />echo&nbsp;</span><span style="color: #0000BB">date_timestamp_get</span><span style="color: #007700">(</span><span style="color: #0000BB">$date</span><span style="color: #007700">);<br /></span><span style="color: #0000BB">?&gt;</span>
</span>
</code></div>
   </div>

   <div class="example-contents"><p>The above examples will output
something similar to:</p></div>
   <div class="example-contents screen">
<div class="cdata"><pre>
1272509157
</pre></div>
   </div>
  </div>
 </div>


 <div class="refsect1 notes" id="refsect1-datetime.gettimestamp-notes">
  <h3 class="title">Notes</h3>
  <p class="para">
   Using <em>U</em> as the parameter to
    <span class="function"><a href="datetime.format.html" class="function">DateTime::format()</a></span>
   is an alternative when using PHP 5.2.
  </p>
 </div>


 <div class="refsect1 seealso" id="refsect1-datetime.gettimestamp-seealso">
  <h3 class="title">See Also</h3>
  <ul class="simplelist">
   <li class="member"> <span class="function"><a href="datetime.settimestamp.html" class="function" rel="rdfs-seeAlso">DateTime::setTimestamp()</a> - Sets the date and time based on an Unix timestamp</span></li>
   <li class="member"> <span class="function"><a href="datetime.format.html" class="function" rel="rdfs-seeAlso">DateTime::format()</a> - Returns date formatted according to given format</span></li>
  </ul>
 </div>


</div><hr /><div class="manualnavbar" style="text-align: center;">
 <div class="prev" style="text-align: left; float: left;"><a href="datetime.getoffset.html">DateTime::getOffset</a></div>
 <div class="next" style="text-align: right; float: right;"><a href="datetime.gettimezone.html">DateTime::getTimezone</a></div>
 <div class="up"><a href="class.datetimeinterface.html">DateTimeInterface</a></div>
 <div class="home"><a href="index.html">PHP Manual</a></div>
</div></body></html>