Trying to create a <label> in a skin that will return the days of the week in an abbreviated form. ie: Mon, Tue, Wed, etc.
I was thinking using System.Date(ddd) would work.
But how would I go about adding to it so the days of the week populate?
I need it to go like this: if today is Fri and the above returns that, how would I code it so that in another <label> I can essentially add 1 so it returns Sat? Add 2 so it returns Sun, etc.
And, no, static labels will not work.
problem with a <label>
adrian ballard
Member Posts: 61 Joined: Aug 2011 Reputation: 0 |
2012-07-06 10:28
Post: #1
|
| find quote |
Hitcher
Skilled Skinner Joined: Aug 2007 Reputation: 67 Location: Eastleigh, UK |
2012-07-06 10:43
Post: #2
I'd use variables.
eg Variables.xml - PHP Code: <?xml version="1.0" encoding="UTF-8"?>Then - PHP Code: <label>$VAR[Day_Plus_1]</label> Just repeat the code for the other days but bump the last $LOCALIZE[nn] to suit. EDIT: $LOCALIZE[41] = Mon / $LOCALIZE[47] = Sun ![]()
(This post was last modified: 2012-07-06 10:45 by Hitcher.)
|
| find quote |
adrian ballard
Member Posts: 61 Joined: Aug 2011 Reputation: 0 |
2012-07-06 20:30
Post: #3
That would appear to work but looks to be a very long work around for what I'm trying to achieve.
Is there not anyway to truncate a string to a specified length? For example: <label>$INFO[Window.Property(Day1.Title)]</label> Result: Wednesday Result I'm trying to achieve: Wed I just want to abbreviate the full string of the day of the week to 3 characters. |
| find quote |
Hitcher
Skilled Skinner Joined: Aug 2007 Reputation: 67 Location: Eastleigh, UK |
2012-07-06 22:07
Post: #4
I thought you wanted the current day followed by the next, then the next, etc in some sort of calendar form.
Just use <label>$INFO[System.Date(ddd)]</label>. ![]() |
| find quote |
adrian ballard
Member Posts: 61 Joined: Aug 2011 Reputation: 0 |
2012-07-06 22:23
Post: #5
My apologies for not being entirely clear.
This is going into the weather page so I do need all the days of the week [in 3 char abbreviated format]. But I need it based off of this variable Window.Property(Day1.Title). <label>$INFO[Window.Property(Day1.Title)]</label> returns SAT <label>$INFO[Window.Property(Day2.Title)]</label> returns SUN <label>$INFO[Window.Property(Day3.Title)]</label> returns MON etc... |
| find quote |
Hitcher
Skilled Skinner Joined: Aug 2007 Reputation: 67 Location: Eastleigh, UK |
2012-07-07 00:54
Post: #6
PHP Code: <variable name="Short_Day">PHP Code: <label>$VAR[Short_Day]</label> ![]() |
| find quote |


![[Image: sig_zps3af3b48e.jpg]](http://i620.photobucket.com/albums/tt289/Arcanthur/Celestium/sig_zps3af3b48e.jpg)
Search
Help