It is currently April 20th, 2024, 5:47 am
How can I make a meter to display my age?
-
- Posts: 6
- Joined: November 10th, 2009, 5:26 am
How can I make a meter to display my age?
How can I have rainmeter calculate my age (in format: 16 years, 2 months, 5 days) and display it in a string meter?
even if you think you're gonna fail, write a victory speech.
-
- Posts: 97
- Joined: July 25th, 2010, 7:23 am
Re: How can I make a meter to display my age?
refer to these sites for the equation:
http://www.exceltip.com/st/Working_Out_a_Person's_Age_in_Microsoft_Excel/634.html
http://www.cpearson.com/excel/datedif.htm
Right now I am working on this calculator and currently have the years function working. I will post the code so you can see it when I finish. The reason I do not explain it is because it uses the IF/logic function in rainmeter's calc measure quite a bit. I do not know how to read these C+ codes on
this site so that I can figure out what calculations to use for someone born on february 29th, but If someone could tell me the functioning rainmeter version for one of the accurate ones, I would be able to finish this.
http://www.exceltip.com/st/Working_Out_a_Person's_Age_in_Microsoft_Excel/634.html
http://www.cpearson.com/excel/datedif.htm
Right now I am working on this calculator and currently have the years function working. I will post the code so you can see it when I finish. The reason I do not explain it is because it uses the IF/logic function in rainmeter's calc measure quite a bit. I do not know how to read these C+ codes on
this site so that I can figure out what calculations to use for someone born on february 29th, but If someone could tell me the functioning rainmeter version for one of the accurate ones, I would be able to finish this.
Away for a while :(
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
-
- Moderator
- Posts: 995
- Joined: June 10th, 2009, 12:44 pm
- Location: Sweden
Re: How can I make a meter to display my age?
On an unrelated note, I'm working on a countdown-skin and would much like to see how you made those years work properly. I have some problem figuring out how to do anything about leap-years in the calculations.Aarowaim wrote:refer to these sites for the equation:
http://www.exceltip.com/st/Working_Out_a_Person's_Age_in_Microsoft_Excel/634.html
http://www.cpearson.com/excel/datedif.htm
Right now I am working on this calculator and currently have the years function working. I will post the code so you can see it when I finish. The reason I do not explain it is because it uses the IF/logic function in rainmeter's calc measure quite a bit. I do not know how to read these C+ codes on
this site so that I can figure out what calculations to use for someone born on february 29th, but If someone could tell me the functioning rainmeter version for one of the accurate ones, I would be able to finish this.
I don't think, therefore I'm not.
-
- Posts: 97
- Joined: July 25th, 2010, 7:23 am
Re: How can I make a meter to display my age?
Well, bad news, the calculation I was using for months was not perfect, but I found out that the calculations I was thinking of using were pretty close (just missing a version for a leap year b-day date). So far, I have the months functioning except when your birthday's date in the month has passed. The days are still not finished, but I have two measures to get the total days in the current year/month if needed (although I do not think this is required if you put the days in a year as 365.25(5) <---the extra 5 is for corrections according to one of those sites(I don't know if it is required). Anyway, here is my skin at the moment. the year calc is fine and tested against leap years the month and days work if you were born in october (not sure about other months, but feb doesn't work).
NOTE: someone born on february 28th, is 1 day older than someone born on february 29th because leap year days still count for people born during any day
Code: Select all
[Rainmeter]
Author=Aarowaim
DynamicVariables=1
[Variables]
;Enter your birthday here, the month must be a number.
;January=1, February=2, March=3, April=4, May=5, June=6, July=7
;August=8, September=9, October=10, November=11, December=12
B-DayMonth=2
B-DayDay=29
B-DayYear=1996
;>>>>>>>>>>>>>>>>>>>>Dates<<<<<<<<<<<<<<<<<<<<
[Year]
Measure=Time
Format=%Y
[Month]
Measure=Time
Format=%#m
[Day]
Measure=Time
Format=%#d
;>>>>>>>>>>>>>>>>>>>>Leap-Year Measures<<<<<<<<<<<<<<<<<<<<
[MonthDays]
Measure=Time
Format=%#d
Total=1
[YearDays]
Measure=Time
Format=%#j
Total=1
;>>>>>>>>>>>>>>>>>>>>Calcs<<<<<<<<<<<<<<<<<<<<
[AgeYear]
Measure=Calc
Formula=#B-DayMonth#>[Month] ? ROUND((Year-#B-DayYear#)-(#B-DayMonth#/12)) : (Year-#B-DayYear#)
Substitute=".00000":" Years"
DynamicVariables=1
[AgeMonth]
Measure=Calc
Formula=#B-DayMonth#>[Month] ? (12-#B-DayMonth#)+[Month] : ([Month]-#B-DayMonth#)
Substitute=".00000":" Months"
DynamicVariables=1
[AgeDay]
Measure=Calc
Formula=
Substitute=".00000":" Days"
DynamicVariables=1
;>>>>>>>>>>>>>>>>>>>>Display<<<<<<<<<<<<<<<<<<<<
[Display]
Meter=String
Text="[AgeYear] | [AgeMonth] | [AgeDay]"
DynamicVariables=1
Last edited by Aarowaim on August 16th, 2010, 10:30 pm, edited 1 time in total.
Away for a while :(
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
-
- Posts: 97
- Joined: July 25th, 2010, 7:23 am
Re: How can I make a meter to display my age?
Here is the age calculator I have been using to get my results. If I could find the javascript that it uses, then this problem is solved. http://www.easycalculation.com/date-day/age-calculator.php
EDIT: I found a page with the javascript required to do this calculation properly, here is the javascript from
http://www.searchforancestors.com/utility/age.html for those who can read it
Give me a little while and I will find out the calculation for a rainmeter version. If you can read javascript, please feel free to get this turned into a skin.
EDIT: I found a page with the javascript required to do this calculation properly, here is the javascript from
http://www.searchforancestors.com/utility/age.html for those who can read it
Code: Select all
<script language="JavaScript">function calcage(mm,dd,yy,mm2,dd2,yy2)
{
var ageyears, agemonths, agedays
yy = yy * 1;
yy2 = yy2 * 1;
if (yy < 1000)
{
alert("Please enter a four digit year (e.g., 1901).");
yy = yy + 1900
}
if (yy < 100 && yy < 20){yy = yy + 2000}
if (yy2 < 100 && yy2 > 20){yy2 = yy2 + 1900}
if (yy2 < 100 && yy2 < 20){yy2 = yy2 + 2000}
firstdate = new Date(mm+'/'+ dd +'/'+ yy)
mm = firstdate.getMonth() + 1
dd = firstdate.getDate()
seconddate = new Date(mm2+'/'+ dd2 +'/'+ yy2)
mm2 = seconddate.getMonth() + 1
dd2 = seconddate.getDate()
ageyears = yy2 - yy
if(mm2 == mm)
{
if(dd2 < dd){
mm2 = mm2 + 12;
ageyears = ageyears - 1;
}
}
if(mm2 < mm){
mm2 = mm2 + 12;
ageyears = ageyears - 1;
agemonths = mm2 - mm;
}
agemonths = mm2 - mm;
if (dd2 < dd) {
agemonths = agemonths - 1;
dd2 = dd2 + 30;
if (mm2 == mm) {
agemonths = 0;
ageyears = ageyears - 1;
}
}
agedays = dd2 - dd;
totalage = ageyears + ' years, '+ agemonths +' months, and '+ agedays +' days';
}
function setForm()
{
seconddate = new Date()
mm2 = seconddate.getMonth() + 1
dd2 = seconddate.getDate()
yy2 = seconddate.getYear()
strYear = yy2;
if (yy2 > 99 && yy2 < 2000){
yy2 = yy2 - 100;
strYear = '0' + yy2;
}
document.forms['calculator'].elements['secondmonth'].value = mm2;
document.forms['calculator'].elements['secondday'].value = dd2;
document.forms['calculator'].elements['secondyear'].value = strYear;
}
</script>
Away for a while :(
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
-
- Posts: 97
- Joined: July 25th, 2010, 7:23 am
Re: How can I make a meter to display my age?
Well, after 2 hours of work, I managed to decipher the equations, but it is returning zero for the months and days measure. I suspect that this is because they both use a string of calc logic.
The answer I recieved @ http://rainmeter.net/forum/viewtopic.php?f=5&t=5110 doesn't seem to work because those two measures are the only ones that use it (they have to in order to work). Anyway, here is what I made from that javascript.
The answer I recieved @ http://rainmeter.net/forum/viewtopic.php?f=5&t=5110 doesn't seem to work because those two measures are the only ones that use it (they have to in order to work). Anyway, here is what I made from that javascript.
Code: Select all
[Rainmeter]
Author=Aarowaim
DynamicVariables=1
[Variables]
;Enter your birthday here, the month must be a number.
;January=1, February=2, March=3, April=4, May=5, June=6, July=7
;August=8, September=9, October=10, November=11, December=12
B-DayMonth=10
B-DayDay=20
;Please enter the full year here. e.g rather than 58, enter 1958.
B-DayYear=1996
;>>>>>>>>>>>>>>>>>>>>Dates<<<<<<<<<<<<<<<<<<<<
[Year]
Measure=Time
Format=%Y
[Month]
Measure=Time
Format=%#m
[Day]
Measure=Time
Format=%#d
;>>>>>>>>>>>>>>>>>>>>Calcs<<<<<<<<<<<<<<<<<<<<
[AgeYear]
Measure=Calc
Formula=[Month]=#B-DayMonth#&&[Day]<#B-DayDay#||[Month]<#B-DayMonth# ? ([Year]-#B-DayYear#)-1 : [Year]-#B-DayYear#
Substitute=".00000":" Years"
DynamicVariables=1
[AgeMonth]
Measure=Calc
Formula=[Day]<#B-DayDay# ? ([Month]=#B-DayMonth# ? (0) : ((([Month]+12)-#B-DayMonth))-1)) : ([Month]-#B-DayMonth#)
Substitute=".00000":" Months"
DynamicVariables=1
[AgeDay]
Measure=Calc
Formula=[Day]<#B-DayDay ? (([Day]+30)-#B-DayDay#) : [Day]-#B-DayDay#
Substitute=".00000":" Days"
DynamicVariables=1
;>>>>>>>>>>>>>>>>>>>>Display<<<<<<<<<<<<<<<<<<<<
[Display]
Meter=String
Text="[AgeYear] | [AgeMonth] | [AgeDay]"
DynamicVariables=1
Away for a while :(
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
-
- Posts: 6
- Joined: November 10th, 2009, 5:26 am
Re: How can I make a meter to display my age?
I am happy enough with the Year and Month display from the first skin post that you made Aarowaim.
THANK YOU VERY MUCH I know this must have been hard and frustrating, and I really appreciate that you helped me out :]
THANK YOU VERY MUCH I know this must have been hard and frustrating, and I really appreciate that you helped me out :]
even if you think you're gonna fail, write a victory speech.
-
- Posts: 97
- Joined: July 25th, 2010, 7:23 am
Re: How can I make a meter to display my age?
Ok, for Chewtoy and edwardb, I have finished the age calculator. It works basically by checking if the birthday dates have passed (e.g if month is less than birthday month) and modifies the main calculation accordingly. I placed the substitute .0000 thing there so that it removes the extra zeros a rainmeter calc adds and it places the measurement of time that it is displaying. Now, I will admit that the previous ones weren't working due to a mistake in scripting (I forgot to add the second # to the variables :shock: ), but I was sleepy when I did that version. rather than merely release the same code again, I looked at the calculations and found a mistake in how the previous one calculated months. If your birthday month hadn't passed yet and it happened to be the same day as your birthday day, then it would show the months as 1 less than it should have shown. The calc strings are now working just fine and Chewtoy, I'm sorry for saying it was your calc strings that weren't working. Anyways, here is the finalized version of this script (minus the metadata). If you wish to recreate this skin to be better looking, please give me credit for obtaining and adapting this equation.
EDIT 5/10/2010:
Fixed the equation, but it still has a glitch somewhere that will make it display -1 years and >12 months in certain situations.
Code: Select all
[Rainmeter]
Author=Aarowaim
DynamicVariables=1
[Variables]
;Enter your birthday here, the month must be a number.
;January=1, February=2, March=3, April=4, May=5, June=6, July=7
;August=8, September=9, October=10, November=11, December=12
B-DayMonth=
B-DayDay=
;Please enter the full year here. e.g rather than 58, enter 1958.
B-DayYear=
;>>>>>>>>>>>>>>>>>>>>Dates<<<<<<<<<<<<<<<<<<<<
[Year]
Measure=Time
Format=%Y
[Month]
Measure=Time
Format=%#m
[Day]
Measure=Time
Format=%#d
;>>>>>>>>>>>>>>>>>>>>Calcs<<<<<<<<<<<<<<<<<<<<
[AgeYear]
Measure=Calc
Formula=[Month]=#B-DayMonth#&&[Day]<#B-DayDay#||[Month]<#B-DayMonth# ? ([Year]-#B-
DayYear#)-1 : [Year]-#B-DayYear#
Substitute=".00000":" Years"
DynamicVariables=1
[AgeMonth]
Measure=Calc
Formula=[Month]=#B-DayMonth#&&[Day]<#B-DayDay#||[Month]<#B-DayMonth# ? ([Month]=#B-
DayMonth#&&[Day]>#B-DayDay# ? (0) : ([Day]=#B-DayDay# ? (([Month]+12)-#B-DayMonth#) :
(([Month]+12)-#B-DayMonth#)-1)) : ([Month]-#B-DayMonth#)
Substitute=".00000":" Months"
DynamicVariables=1
[AgeDay]
Measure=Calc
Formula=[Day]<#B-DayDay# ? (([Day]+30)-#B-DayDay#) : [Day]-#B-DayDay#
Substitute=".00000":" Days"
DynamicVariables=1
;>>>>>>>>>>>>>>>>>>>>Display<<<<<<<<<<<<<<<<<<<<
[Display]
Meter=String
Text="[AgeYear] | [AgeMonth] | [AgeDay]"
DynamicVariables=1
Fixed the equation, but it still has a glitch somewhere that will make it display -1 years and >12 months in certain situations.
Last edited by Aarowaim on October 6th, 2010, 1:09 am, edited 1 time in total.
Away for a while :(
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
-
- Moderator
- Posts: 995
- Joined: June 10th, 2009, 12:44 pm
- Location: Sweden
Re: How can I make a meter to display my age?
Well that's good. But I'm a tad confused, where did you get a Calc that I had done? ._o
I don't think, therefore I'm not.
-
- Posts: 97
- Joined: July 25th, 2010, 7:23 am
Re: How can I make a meter to display my age?
Well, I was referring to this:
You told me to put any extra calc logic into brackets.Aarowaim wrote:The answer I recieved @ http://rainmeter.net/forum/viewtopic.php?f=5&t=5110 doesn't seem to work because those two measures are the only ones that use it (they have to in order to work).
Away for a while :(
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]
Programming isn't a hobby, it's a lifestyle choice.
[url=http://www.rainmeter.net/forum/viewtopic.php?f=83&t=1207][b]T34M V.1.5.0.|2[/b][/url] <----I'ts l33t, look it up
Coding Skills: [color=#00FFFF]4.5[/color]
Answering Skills: [color=#00FFFF]4[/color]
Image Editing: [color=#00FFFF]3[/color]
Knowledge: [color=#00FFFF]4.5[/color]
Technical Skills: [color=#00FFFF]3[/color]