<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://halfgeek.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Formatting_time_%28perl%29</id>
	<title>Formatting time (perl) - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://halfgeek.org/wiki/index.php?action=history&amp;feed=atom&amp;title=Formatting_time_%28perl%29"/>
	<link rel="alternate" type="text/html" href="https://halfgeek.org/wiki/index.php?title=Formatting_time_(perl)&amp;action=history"/>
	<updated>2026-05-28T12:19:28Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.0</generator>
	<entry>
		<id>https://halfgeek.org/wiki/index.php?title=Formatting_time_(perl)&amp;diff=311&amp;oldid=prev</id>
		<title>161.253.47.104 at 22:45, 14 November 2005</title>
		<link rel="alternate" type="text/html" href="https://halfgeek.org/wiki/index.php?title=Formatting_time_(perl)&amp;diff=311&amp;oldid=prev"/>
		<updated>2005-11-14T22:45:59Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;=MySQL format=&lt;br /&gt;
&lt;br /&gt;
This function returns a time formatted into the MySQL format, YYYY-MM-DD HH:mm:SS.  The time may be passed as a [[Unix timestamp]] or as the result of gmtime or localtime.&lt;br /&gt;
&lt;br /&gt;
 &amp;lt;nowiki&amp;gt;&lt;br /&gt;
sub form_time {&lt;br /&gt;
	if(@_ &amp;gt; 1) {&lt;br /&gt;
		my ($sec,$min,$hour,$mday,$mon,$year) = @_;&lt;br /&gt;
		++$mon;&lt;br /&gt;
		$year += 1900;&lt;br /&gt;
		return sprintf(&amp;#039;%04d-%02d-%02d %02d:%02d:%02d&amp;#039;,&lt;br /&gt;
			$year,$mon,$mday,$hour,$min,$sec);&lt;br /&gt;
	}&lt;br /&gt;
	elsif(@_ == 0) {&lt;br /&gt;
		return form_time(gmtime());&lt;br /&gt;
	}&lt;br /&gt;
	else {&lt;br /&gt;
		return form_time(gmtime($_[0]));&lt;br /&gt;
	}&lt;br /&gt;
}&amp;lt;/nowiki&amp;gt;&lt;/div&gt;</summary>
		<author><name>161.253.47.104</name></author>
		
	</entry>
</feed>