Page 1 of 1

ASP to PHP problem

Posted: Tue Oct 30, 2007 6:52 am
by Verner
feyd | Please use

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi, i must port a website from ASP to PHP. Im not very familliar with PHP and now I'm stuck with the translation.

[syntax="asp"]alt_txt = "Reminder " & WeekDayName(WeekDay(sDate)) & " ( " & Day(sDate) & ")" & MonthName(Month(sDate)) & " " & Year(sDate)
How would this look like in PHP?


Thanks!

/Carl


feyd | Please use[/syntax]

Code: Select all

,

Code: Select all

and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

is good you are moving away from asp

Posted: Tue Oct 30, 2007 10:43 am
by yacahuma
is good you are moving away from asp. I dont use ASP but you will have a hard time finding a better documentation than PHP.


take a look at the date function.

the most important site you will ever use is php.net
just type date in the "search for" field

for example monthname ('assuming it return the name of the month) will be

$sDate = mktime(); <--search for this function too
date('F',$sDate);

Posted: Tue Oct 30, 2007 10:44 am
by feyd
Do you know what the statement(s) says, in plain (English) form? If so, please tell us. We can easily translate from there.

Posted: Tue Oct 30, 2007 4:14 pm
by Doug G
Assuming it's vbscript code, the snip will populate a string variable named alt_txt by parsing a variable sDate, presumably a string representation of the date value. alt_txt will end up with a string

"Reminder Tuesday (30) Oct 2007" if sDate contained "10/30/2007" (in US format).

You can find the vbscript function reference here: http://msdn2.microsoft.com/en-us/library/3ca8tfek.aspx

Posted: Tue Oct 30, 2007 11:52 pm
by Stryks
It's going to depend alot on how $sDate is formatted (and if it is uniformly formatted), but yeah .. something like the following could be along the lines of what you want.

Code: Select all

<?php
	$sDate = '10/30/2007';
	list($month, $day, $year) = explode('/',$sDate);
	$alt_txt = date('l (d) F Y', mktime(0, 0, 0, $month, $day, $year));
	
	echo $alt_txt;
?>
Cheers