Posted: Mon Dec 08, 2008 6:57 pm Post subject: countdown
i have tried before on this topic and rdrake gave me some options but were out of my programming skills ( no offense didn't understand)
sooo back to my programming "foundation"
if anyone can help me on making a countdown to Christmas or any day that would be great
(sorry mods/admins if you don't like this i ran out of searching material and i wanted to make this a learning experience {and tony thanks but the one you made for me was great but i wanted to make into a .exe and i am not sure how sooo back to what is familiar})
Sponsor Sponsor
DanielG
Posted: Mon Dec 08, 2008 7:08 pm Post subject: RE:countdown
I think the easiest way is to find how many seconds away your date is from 1970, and use Time.Sec to find the time now from 1970, then use mods and divison to rewrite the difference in weeks, days, hours, minutes, seconds, or whatever units you want it to be in.
rdrake
Posted: Mon Dec 08, 2008 7:48 pm Post subject: Re: countdown
If you have a choice between VB.NET and Turing, use VB.NET.
C#:
DateTime dt = new DateTime(2008, 12, 25);
TimeSpan ts = dt - DateTime.Now;
Console.WriteLine("There are " + ts.Days + " days left until Christmas.");
ecookman
Posted: Mon Dec 08, 2008 9:37 pm Post subject: RE:countdown
i i dunno if it is vb net
just says visual basic express edition so i went to the unforgiving "beast" of turing...
turing codes would be helpful i know nothing about C#... i have looked and ripped some scripts (changing values in variables) but nothing major
p.s thanks for your time
ecookman
Posted: Mon Dec 08, 2008 9:39 pm Post subject: Re: RE:countdown
DanielG @ Mon Dec 08, 2008 7:08 pm wrote:
I think the easiest way is to find how many seconds away your date is from 1970, and use Time.Sec to find the time now from 1970, then use mods and divison to rewrite the difference in weeks, days, hours, minutes, seconds, or whatever units you want it to be in.
\
i am sorry you lost me there
to me sounds like i am trying to find Christmas in 1970 and how long it has been since then
Insectoid
Posted: Mon Dec 08, 2008 9:44 pm Post subject: RE:countdown
Well, the Turing timer counts in seconds (milliseconds?) from 1970 (odd, I know). Time.Sec will return the number of seconds since 1970. So you need to find out how many seconds are between 1970 and christmas 2008 and subtract that from what you got from time.sec. convert that to days/hours/minutes and you're good!
Tony
Posted: Mon Dec 08, 2008 10:14 pm Post subject: Re: RE:countdown
insectoid @ Mon Dec 08, 2008 9:44 pm wrote:
Well, the Turing timer counts in seconds (milliseconds?) from 1970 (odd, I know).
It's not Turing, it's the system time, also known as POSIX time. It's a well known fact that time began on January 1st, 1970; And that time will end on January 19, 2038 -- http://en.wikipedia.org/wiki/Year_2038_Problem
Posted: Tue Dec 09, 2008 12:31 am Post subject: Re: RE:countdown
ecookman @ Mon Dec 08, 2008 9:37 pm wrote:
i i dunno if it is vb net
just says visual basic express edition so i went to the unforgiving "beast" of turing...
turing codes would be helpful i know nothing about C#... i have looked and ripped some scripts (changing values in variables) but nothing major
p.s thanks for your time
The same classes are shared between C# and VB.NET. I guarantee you 99% of that code will work unmodified in a VB.NET application. Just remove the semicolons to dumb down the syntax a bit.
Sponsor Sponsor
gianni
Posted: Tue Dec 09, 2008 2:37 am Post subject: RE:countdown
UNIX EPOCH
ecookman
Posted: Tue Dec 09, 2008 10:50 am Post subject: RE:countdown
^
post |
|with
related|
|and useful
substance|please
*smacks head off desk*
this isn't helping if someone could start the code....i am really lost i know nothing about these functions AND i still do not understand the math
p.s the helpdesk in turing doesnot work for me
gianni
Posted: Tue Dec 09, 2008 11:00 am Post subject: RE:countdown
Okay dude, I don't mean to be an asshole or anything, but 2 people have already told you *exactly* what you need to do. And you have even been given at least 2 working code examples as well.
Not knowing a certain language or feature of said language is irrelevant.
You have a problem, they have given you the steps to solve the problem, you need to piece it together.
Solution: You have 2 dates (now and Christmas) all you need to do is find the difference. That will give you time remaining until Christmas.
ecookman
Posted: Tue Dec 09, 2008 5:41 pm Post subject: RE:countdown
yes but I for one like to understand what the code is doing...
I DON'T have vb.net...i don't have Ruby
i tried to get ruby...but it doesn't work for me.
soo guess what that is why i moved this to the TURING section... makes sence right
i have tried to make one and failed...i have googled it and you guessed it failed . That is why i have asked for someone to start off the code and tell me how to use the different functions....
I am a beginner to programming sooo my syntax and source code skills aren't that good (only about 4 months i have been programming)
you might be a expert programmer, but i am not...if you have a solution please help...if i understood what to do i would have already
as md said to me....be a problem solver and use decisive thinking. (if you think about it i wouldn't still be on this problem if i had understood the first time...right???)
so please. If you have any input to my problem...share
gianni
Posted: Tue Dec 09, 2008 5:48 pm Post subject: RE:countdown
If you read the end of my last post just after "Solution:" you'll see that I have told you exactly what you have to do. It's not even pseudo-code, it's plain english.
So, after reading that, logical thinking will lead you too research date handling in your language of choice. From there you might find out how to perform basic mathematical functions with dates. Now by this point ... you are done.
ecookman
Posted: Tue Dec 09, 2008 6:22 pm Post subject: RE:countdown
as i have said before i have tried that please, you are starting to troll
[Gandalf]
Posted: Tue Dec 09, 2008 6:31 pm Post subject: RE:countdown
What exactly is it that you don't understand? Everyone could be a lot more helpful if you'd be a bit more specific than that you don't get it and you've googled it.
I'm assuming you can't find the functions you need. For this, all you need is to search through the Turing Documentation. You have:
Quote:
Syntax Time.PartsSec (year, month, day, hour, minute, second : int) : int
Description The Time.PartsSec function is used to convert the numeric parts of a date (specifically the year, month, day, hour, minute and second) into the number of seconds since 00:00:00 GMT Jan 1, 1970 and the date specified by the parts.
And Time.Sec, which has already been mentioned:
Quote:
Syntax Time.Sec : int
Description The Time.Sec function returns the current date and time as a number. The returned integer is the time in seconds since 00:00:00 GMT (Greenwich Mean Time) January 1, 1970.
Now, subtract both values and you have the time in seconds. From there, it's grade 2 work to figure out the amount of days.