It is currently May 3rd, 2024, 3:26 am

Measure the day of a particular date.

General topics related to Rainmeter.
juman
Posts: 5
Joined: May 20th, 2011, 3:28 pm

Measure the day of a particular date.

Post by juman »

The title all clears it right?
so there will be 6 then i want rainmeter to calculate the day(Friday,Sunday...)
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Measure the day of a particular date.

Post by jsmorley »

What do you mean "a particular date"? Where are you getting the date from? What format is it in?

If you just want the day of the week as text from today's date, it is:

[MeasureDayOfWeek]
Measure=Time
Format=%A

[MeterDayOfWeek]
Meter=String
MeasureName=MeasureDayOfWeek

If you are getting a "date" from somewhere else, like a WebParser measure, and want to change a day number in day text, just use:

Substitute="0":"Sunday","1":"Monday","2":"Tuesday","3":"Wednesday","4":"Thursday","5":"Friday","6":"Saturday"

On the measure returning the day of the week from 0 to 6.
juman
Posts: 5
Joined: May 20th, 2011, 3:28 pm

Re: Measure the day of a particular date.

Post by juman »

jsmorley wrote:What do you mean "a particular date"? Where are you getting the date from? What format is it in?

If you just want the day of the week as text from today's date, it is:

[MeasureDayOfWeek]
Measure=Time
Format=%A

[MeterDayOfWeek]
Meter=String
MeasureName=MeasureDayOfWeek

If you are getting a "date" from somewhere else, like a WebParser measure, and want to change a day number in day text, just use:

Substitute="0":"Sunday","1":"Monday","2":"Tuesday","3":"Wednesday","4":"Thursday","5":"Friday","6":"Saturday"

On the measure returning the day of the week from 0 to 6.
there are a numbers ranging from my 1 to 31 i want my config to display the day of the number beside it.
User avatar
jsmorley
Developer
Posts: 22631
Joined: April 19th, 2009, 11:02 pm
Location: Fort Hunt, Virginia, USA

Re: Measure the day of a particular date.

Post by jsmorley »

That gets enormously complicated. You will need some kind of full blown calendar capability to know that July 4, 1776 was a "Tuesday" or whatever it was. There are leap years and all kinds of other considerations. Someone else may want to weigh in on this, but it is beyond my available time to tackle.
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Measure the day of a particular date.

Post by Chewtoy »

It actually won't get all that complicated if you are willing to learn how to do things in Lua.
Lua have this nice os.time() function that will get you what you want.

Example:

Code: Select all

when = os.time({year=2011, month=06, day=24})
WhatDay = os.date("%a", when)
This simple piece of code will give you the weekday of some date (I've put in 24th of June 2011 as you can see).
You can simply get the current year, month and day in lua too, and play with it. So if you are willing to learn some Lua, you can do wonders.

If you want to see this in action have a look at this skin: http://vonsmallhausen.deviantart.com/#/d3d7obj
It uses what I just told you about and I've included some comments so you can see what things do. Be sure to have the manual at hand though.

To get everything in position is more tedious though, as you will have to align it properly. Otherwise it should be really simple, might knock something out actually... We'll see. But what I've given you now should give you a good start.
I don't think, therefore I'm not.
User avatar
Chewtoy
Moderator
Posts: 995
Joined: June 10th, 2009, 12:44 pm
Location: Sweden

Re: Measure the day of a particular date.

Post by Chewtoy »



You wanted something like that?
It's totally possible. ;)

With the help of Lua it's actually really simple. Some tedious work, but very much possible and not extremely hard.
I don't think, therefore I'm not.
jcarla
Posts: 2
Joined: July 28th, 2011, 6:49 am

Re: Measure the day of a particular date.

Post by jcarla »

Thanks guys for the info
lex2000
Posts: 2
Joined: August 2nd, 2011, 7:09 pm

Re: Measure the day of a particular date.

Post by lex2000 »

Thanks for this :) :bow:
rain rain go away come again another day