as3 - Adding one month - actionscript-3

I'm working currently with actionscript 3 and found out, that it always displays one month less than it actually is (currently it displays "21.11.2015", but should display "21.12.2015"). That's why I wanted to know the command for adding "1" to my "my_date.month". I didnt post the code with date and year, just with the month. Thanks in advance.
function onTimer(e:TimerEvent):void {
my_date = new Date();
tag.text = "" +my_date.month);
}

Thanks to all for answering and help. I could make it by forcing an array from 01 till 12. -> Displaying this array solved my question :)

The month property of the Date class returns 0 to 11. This aligns with arrays being zero-based, meaning that the first element in the array has an index of zero (0).
Date Class:
month : Number
The month (0 for January, 1 for February, and so on) portion of a Date object according to local time.

Related

How to convert an SSIS Date Variable to String In order to return the 2 digit month value?

I have an SSIS variable #[User::SelectedDate] from which I want to return the 2 digit month value to use in an expression. How do you do this?
(DT_STR,4,1252) DATEPART ("yy",#[User::SelectedDate]) returns the year as text, but how do you get the two digit month value?
I tried (DT_STR,4,1252) DATEPART("mm",#[User::SelectedDate]) to return the month but it does not work. It returns "1" while the value is 2021-10-31, so no idea what I am doing wrong. Important to add that I need the two digit value, so "02" for February, not "2"
Note: The variable is not the current date. I have seen many similar questions where getdate() is used as a solution. This wouldn't work in this case, as the date is selected from a database table
Any help will be much appreciated.
Have already wasted an hour on this.
Thanks!
If you are having trouble with datepart. you can always use script component or task.
Component:
string strMonth = Variables.SelectedDate.ToString("MM"); //Note capital MM as mm means minutes
Task:
string strMonth = Dts.Variables["SelectedDate"].Value.ToString("MM");

Zabbix. How use function as of parameter another function

Idea use computed property to get difference between first day of month and current.
I use formula:
last("prtMarkerSuppliesLevel.1.2") - last("prtMarkerSuppliesLevel.1.2", dayofmonth("prtMarkerSuppliesLevel.1.2") )
first part work properly, but then i use dayofmonth i get error
Cannot evaluate expression: unexpected token at ")".
What is wrong?
Answer from zabbix forum thread link
Sorry, but you can not use last function in such way, it does not
support another last function as argument
the possible workaround - just create an item with scheduled interval
:
https://www.zabbix.com/documentation...stom_intervals
interval will be something like this: Code: md1h0m0 every 1st day of
each month at 0:00 This value will be collected only once a month and
will represent your prtMarkerSuppliesLevel at the begining of the
month.
then you can use last(your.current.item) - last(scheduled.item)
Regards, Kaspars

SSRS - weekday name

any advice appreciated
I have as a column heading the expression =WeekdayName(weekday(fields!date.value))
This returns the day of the week, however, it is returning a day of the week one day in advance, eg when I put Monday's dates in the parameter it shows as 'Tuesday' in the report.
My question is can the above expression be tweaked to show the WeekdayName one day before, eg =WeekdayName(weekday(fields!date.value -1)) ? I tried this but got an error.
Thanks.
So you want to subtract one day from the your incoming date then you can use the
= DateAdd("d", -1, yourdateField)
This way you can subtract the any number of days from your date.
But did you try to see why it is giving the day of previous date. Do check the system date time or else check with the
=WeekdayName(weekday(Today()))
and see if it gives you the correct day of week for current date.
Weekday and weekdayname functions have both another optional argument for defining the starting day of the week.
Problem is the 2 functions don' t default this argument to the same value so depending on your server settings you should explicitly set the second argument of these functions.
No need to invoke a date function. As the weekday() function returns and integer you can offset the result and use the Mod operator to keep it in bounds:
=WeekdayName((weekday(fields!date.value)+5) Mod 7)+1)
The parenthesis are important to ensure the addition comes first.
Just for reference:
OP asked again because of the weekday offset and this is the correct provided solution.
=WeekdayName(weekday(Today())) gives me tomorrow
=WeekdayName(Weekday(Today(),FirstDayOfWeek.System))

Actionscript 3 Date by number

I want to get the date by a number that I send from my server but I can't get it working it always says 1-1-1970.
This is the code that i used
creationDate = new Date(Number(creationTime));
But now is my question wich value must the creationtime have so it has a working date.
I tryed the timestamp and many other numbers like 01042014 but it doesn't work.
When you create Date instance with one parameter this parameter must be the the number of milliseconds since January 1, 1970 0:00:000 GMT. If you want to create 'Date' instance based of known year, month, day you need to write next:
var millenium:Date = new Date(2000, 0, 1); // warning: days start from 1, but months start from 0

How to get current month name in SSRS?

I need current month name as default perameter name in my ssrs report. How can I get current month name using an ssrs expression?
For example "27-09-2012" would become "September"
and one more i need....
27-09-2012 to previous month name as well (August)
First question:
=MonthName(Month(Fields!datefield.Value))
Second question:
=MonthName(Month(DateAdd("m", -1, Today())))
I think the second question answer might be something like that, first converting the date to month then subtracting 1 from the month value and then converting it to month name.
Further reading:
SSRS Reports get Month name from Month Index or from date
Converting month number to month name in reporting services
OFF: I would change the date format you are using to 2012-09-27 as it works in every setting and should give you peace of mind when converting date formats.
Don't subtract 1 b/c it won't work for January.
Use this:
MonthName(Month(DateAdd("m", -1, CDate(Today))))
As a note, I tried the suggestion of =MonthName(Month(today())). What I would get is #error for whatever field the expression was in. However, =MonthName(str(Month(today()))) worked for me. I am unsure of whether or not the MonthName method changed to require a string or if it is some issue with my program. Just figured I would post this in case anyone else was having the same issue.
For Previous Month i found universal way : =MonthName(Month(CDate(Today()))-1,False) for SEPTEMBER (Full Month Name) 'OR'
=MonthName(Month(CDate(Today()))-1,True) for SEP (Short Month Name)