2012-09-28 46 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