Different Date and Time Formats

Written by @m_k_amin 20 November 2012

This PHP code shows full date and time in different standard formats. It uses standard PHP predefined constants to show the date and time. The value of the constants are also shown by this code; Enjoy! (Note that repeated format with different constants are omitted!)

Code Snippet:

                                                
                                                <!-- this script is provided by https://www.phpfreecode.com coded by: Kerixa Inc. -->
<!-- This Script is from www.phpfreecpde.com, Coded by: Kerixa Inc-->
<?php
$dd=array(DATE_ATOM,DATE_ISO8601,DATE_RFC850,DATE_RFC1036,DATE_RSS,DATE_W3C);
?>
<table style="border: 1px solid #000000;width: 600px" align="center">
	<tr>
		<td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: center;width: 298px; color: #2214B9;border-style: solid;border-width: 1px;">
		<strong>ID</strong></td>
		<td style="font-family: 'Times New Roman', Times, serif;font-size: 17pt;text-align: center;color: #2214B9;border-style: solid;border-width: 1px; width: 298px;">
		<strong>Date</strong></td>
	</tr>
<?php
for ($i=0;$i<count($dd);$i++){
?>
	<tr>
		<td style="font-family: 'Times New Roman', Times, serif;font-size: 15pt;text-align: center;width: 298px; color: #2214B9;border-style: solid;border-width: 1px;">
		<?php echo $dd[$i]?> </td>
		<td style="font-family: 'Times New Roman', Times, serif;font-size: 15pt;text-align: center;color: #2214B9;border-style: solid;border-width: 1px; width: 298px;">
		<?php echo date($dd[$i])?></td>
	</tr>
<?php } ?>
</table>

<div style="text-align: center">

<br><font face="Tahoma"><a target="_blank" href="http://www.phpfreecode.com/"><span style="font-size: 8pt; text-decoration: none">PHP Free Code</div>
</span></a></font><a target='_blank' href='https://www.phpfreecode.com' style='font-size: 8pt; text-decoration: none'>Php Best Codes</a>                                                
                                            

Example:


About @m_k_amin

This user is pending a biography.

M

Comments


Here you can leave us commments. Let us know what you think about this code tutorial!

0 / 300

TRENDING POST
1
2
3
4
5
VISITORS
Online Users: 12
Recent Members: grkkid, Manaakividuinfo.com, karticksv, sava, tinatina
advertisement 2