2012-09-28 47 views
0

我正在使用jQuery模板在我的網站上顯示視頻切片 。 問題是我想永遠顯示華爾街網站上的最新視頻。視頻按日期分組。動態更改視頻鏈接以獲取最新視頻

例如,對於今天的視頻:src="http://m.wsj.net/video/20120928/092812hubammarkets/092812hubammarkets_320k.mp4"

我想根據今天的日期動態改變src

你知道該怎麼做嗎?

謝謝

回答

0

你可以只使用一個DateTime對象爲當前日期,然後放置在年,月,日,他們需要去(如果該字符串的其餘部分是始終不變)的字符串。

事情是這樣的:

DateTime testDate = DateTime.Now; 
string year = testDate.Year.ToString(); 
string month = testDate.ToString("MM"); 
string date = testDate.Day.ToString(); 
string yearTwoDigit = testDate.ToString("yy"); 
string source = "src=\u0022http://m.wsj.net/video/"+year+month+date+"/"+month+yearTwoDigit+"hubammarkets/"+month+date+yearTwoDigit+"hubammarkets_320k.mp4\u0022"; 

\ u0022是"字符

這是一個C#示例,這是你的標籤之一。

+0

非常感謝你本 – user1707246