need a bit of help

Show off and share your LcdStudio 2.0 Designs.

Moderator: LcdStudio2 Experts

need a bit of help

Postby Fly » Wed Sep 17, 2008 8:17 pm

Just created my first item \o/, i dont know any script languages so dont laught at it :P
Code: Select all
int s = ((Int32)GetData("Time.Seconds"));
int min = ((Int32)GetData("Time.Minute"));
int h = ((Int32)GetData("Time.Hour"));
int d = ((Int32)GetData("Date.Day"));
int m = ((Int32)GetData("Date.Month"));
int y = ((Int32)GetData("Date.Year"));

DateTime current = new DateTime(y, m, d, h, min, s);
DateTime boom = new DateTime(2008, 9, 28, 14, 30, 0); //particle collider fire date or whatever you want
TimeSpan left = boom.Subtract ( current );

return (left.ToString());

I'm using it to remind myself how much time left untill something happens (PoS runs out of fuel in eve online etc), but i have small problem the output it gives is something like xx.yy:yy:yy where xx is days left, and yy:yy:yy is hours,minutes,seconds left, is there anyway to format output? i want something like xx days yy hours left.
Fly
 
Posts: 1
Joined: Wed Sep 17, 2008 8:03 pm

Sharp

Postby spock » Thu Sep 18, 2008 12:42 am

The script language is C#, so you can do a search on MSDN for string and date manipulation methods and functions.
Cheers!
Live long and prosper...
User avatar
spock
Site Admin
 
Posts: 4541
Joined: Mon Feb 17, 2003 6:01 pm
Location: Athens, Greece

Postby UNOPARATOR » Thu Sep 18, 2008 6:50 am

Change the last to this:
Code: Select all
return left.Days.ToString() + " days " + left.Hours.ToString() + " hours left";
For more information about how to use TimeSpan structure, you can check here:
http://msdn.microsoft.com/en-us/library ... ties(VS.80).aspx
UNOPARATOR
Homo Moderatus
 
Posts: 917
Joined: Tue Jul 19, 2005 7:11 pm
Location: Istanbul, Turkey


Return to Designs

Who is online

Users browsing this forum: Bing [Bot] and 0 guests

cron