ASP to PHP problem

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Verner
Forum Newbie
Posts: 1
Joined: Tue Oct 30, 2007 6:46 am

ASP to PHP problem

Post 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]
User avatar
yacahuma
Forum Regular
Posts: 870
Joined: Sun Jul 01, 2007 7:11 am

is good you are moving away from asp

Post 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);
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Doug G
Forum Contributor
Posts: 282
Joined: Sun Sep 09, 2007 6:27 pm

Post 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
User avatar
Stryks
Forum Regular
Posts: 746
Joined: Wed Jan 14, 2004 5:06 pm

Post 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
Post Reply