LcdStudio.Com Forum Index
RegisterSearchFAQMemberlistUsergroupsLog in
need a bit of help

 
Reply to topic    LcdStudio.Com Forum Index » Designs View previous topic
View next topic
need a bit of help
Author Message
Fly



Joined: 17 Sep 2008
Posts: 1

Post need a bit of help Reply with quote
Just created my first item \o/, i dont know any script languages so dont laught at it Razz
Code:
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.
Wed Sep 17, 2008 8:17 pm View user's profile Send private message
spock
Site Admin


Joined: 17 Feb 2003
Posts: 4526
Location: Athens, Greece

Post Sharp Reply with quote
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...
Thu Sep 18, 2008 12:42 am View user's profile Send private message Send e-mail Visit poster's website ICQ Number
UNOPARATOR
Homo Moderatus


Joined: 19 Jul 2005
Posts: 915
Location: Istanbul, Turkey

Post Reply with quote
Change the last to this:
Code:
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/system.timespan_properties(VS.80).aspx
Thu Sep 18, 2008 6:50 am View user's profile Send private message
Display posts from previous:    
Reply to topic    LcdStudio.Com Forum Index » Designs All times are GMT + 1 Hour
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.