
-----------------------------------
dajoubert12
Sat Oct 12, 2013 4:25 pm

Need some help using the Time.Date and string functions
-----------------------------------




[size=14][b]Please specify what version of Turing you are using
4.1.1

-----------------------------------
DemonWasp
Sat Oct 12, 2013 6:08 pm

RE:Need some help using the Time.Date and string functions
-----------------------------------
Look at Time.DateSec to convert your format "03 Jun 92" into seconds (since the "epoch", defined as 00:00:00 Jan 1st 1970 GMT). See http://compsci.ca/holtsoft/doc/time_datesec.html

Then you can use Time.Sec to get the current date in seconds (since the same epoch as above). See http://compsci.ca/holtsoft/doc/time_sec.html

There is a very simple bit of math you can use to figure out how many seconds are between (birthday) and (now). What is it?

Once you have that number of seconds, you can use Time.SecParts to get the number of years, months, days, hours, minutes and seconds elapsed. See http://compsci.ca/holtsoft/doc/time_secparts.html

There is a key limitation to using dates that are stored as "the number of seconds since the epoch". What is it? (Hint: try entering your parents' or grandparents' birthdates).

-----------------------------------
dajoubert12
Sun Oct 13, 2013 5:19 pm

Re: Need some help using the Time.Date and string functions
-----------------------------------
Ok thanks. A problem I just encountered is that when the user inputs their birthday and I only want to use one variable, it only takes the day of the month entered because of the space in between the days, months, and year of the person's birthday. Is there a code I can use so it takes all three parts in one string variable?

-----------------------------------
DemonWasp
Sun Oct 13, 2013 6:17 pm

RE:Need some help using the Time.Date and string functions
-----------------------------------
Can you post the code you're using (in [syntax=" turing "] [ /syntax] blocks), plus your input, expected output, and actual output?

-----------------------------------
dajoubert12
Sun Oct 13, 2013 7:24 pm

Re: Need some help using the Time.Date and string functions
-----------------------------------
Sorry I don't understand what you're asking for. What sort of code are you looking for?

-----------------------------------
Raknarg
Sun Oct 13, 2013 8:11 pm

RE:Need some help using the Time.Date and string functions
-----------------------------------
Have you written any code?

-----------------------------------
dajoubert12
Mon Oct 14, 2013 5:29 am

Re: Need some help using the Time.Date and string functions
-----------------------------------
Sorry I don't understand what you're asking for. What sort of code are you looking for?

-----------------------------------
Nathan4102
Mon Oct 14, 2013 8:32 am

RE:Need some help using the Time.Date and string functions
-----------------------------------
The code you typed into Turing,below the run button. You said you're getting incorrect output, so you have typed some code, right?

-----------------------------------
Raknarg
Mon Oct 14, 2013 7:45 pm

RE:Need some help using the Time.Date and string functions
-----------------------------------
We don't write code for you, we like you to try on your own first, and then come to us for help. try something out first, and show us what you did. Unless you're really, really stuck
