PDA

View Full Version : convert asp to php


grandpafred
September 22nd, 2007, 21:32
A raw noob at php... trying to convert an ASP date to a PHP date but I'm getting an error
ASP is:

<%
Dim yy
yy = DatePart("yyyy",Now())
%>
<p> &copy; 2006-<%=yy%> </p>


PHP is:
<?php

$yy = DatePart("yyyy",date("n/j/Y g:i:s A")());
?>
<p> &copy; 2006-<?=$yy?> </p>

inimino
September 22nd, 2007, 22:26
PHP has no function called DatePart() so that will not work. However, date() alone will do everything you need, just read the documentation to see what format string you need to produce the output you want:

http://www.php.net/manual/en/function.date.php

grandpafred
September 22nd, 2007, 22:46
PHP has no function called DatePart() so that will not work. However, date() alone will do everything you need, just read the documentation to see what format string you need to produce the output you want:

http://www.php.net/manual/en/function.date.php

thanks... just did what you suggested and still can't get it to work... I obviously need to regroup and look some more

grandpafred
September 22nd, 2007, 22:53
this works
<p> &copy; 2006 - <?php echo date("y"); ?> </p>