Walking horse lamp web parts

xiaoxiao2021-03-06  64

Walking horse lamp web parts

Yesterday afternoon, I used a afternoon to write a WebPart that walked the horse. This WebPart can customize font size, color, width, rolling speed, and so on.

There is no special thing in this walk, the main date is compared.

May be due to the C # language is not a very familiar relationship, I don't know if there is a function to convert the string into a DateTime type, anyway, I didn't find it, so I used the following block to complete this conversion task.

// Get expiration date

String strdate = item ["Expired Time"] .tostring ();

// Get the year

String stry = strdate.substring (0, 4);

// The string of the merits and days to a temporary variable, such as "8-20 0:00:00"

String strat = strdate.substring (5, strdate.length-5);

// Now there is only one "-" in front of the date left, get his location

INT INTINDEX = STRT.INDEXOF ("-");

/ / Take out the "-", you will take the month

String strm = strt.substring (0, intIndex);

// Remove the date because there is still time, so you have to take a space from "-".

String strd = strt.substring (intIndex 1, strt.indexof (") -intIndex-1);

/ / Create a DateTime type, convert the removed strings into places, put it in the position of the corresponding parameters

DateTime DT1 = New DateTime (int.Parse (stry), int.Parse (STRM), INT.PARSE (STRD), 0, 0, 0, 0);

/ / There is no expiration display, you can use it to compare

IF (dt1> = datetime.now)

{

J ;

Str = STR " TEM [" hyperlink "] .tostring () " / "style = /" color: " _strfontcolor "; font-size: " _strfontsize " / ">" j.toString () "" Item ["Title"] .tostring () "";

}

转载请注明原文地址:https://www.9cbs.com/read-111063.html

New Post(0)