sakthi kj
19th July 2018, 15:29
hello,,mark_h….
how to subtract the current month and year to previous month and year ???
pls,,, I need to example script......quickly reply...plssss,,,,,
mark_h
20th July 2018, 16:12
First moved to a new thread. Not sure I get the question and what your expected output should be. On the sessions where I ask for a month and year - I always assume the 1st of the month. So then I just create a date start.date = date.to.num(year.f,month.f,1). If you want to know the number of months between the two dates - you could create a formula or something. So it is hard to post an example without know what you really need. Plus you can always search this form for date example. I am sure there are quite a few.
bdittmar
21st July 2018, 21:56
Hello,
you can use:
utc.add()
Syntax:
function long utc.add (long i.utc, long year, long month, long day, long hour, long minute, long second, long o.utc)
Description
This adds years, months, days, hours, minutes, seconds to the input utc value and makes corrections if necessary.
It processes the parameters from bigger to smaller units:
First adds only years and the date is corrected (if started from a leap year)
Than the months are added and the date is corrected to an existing one.
The addition of days follow, and the result is so far the same hour, minutes, as it was in the beginning in the actual time-zone.
Finally the hours, minutes, seconds are added.
Arguments
long i.utc
long year
long month
long day
long hour
long minute
long second
long o.utc
Return values
0 Success.
1 Best guess.
2 Failure.
Example
This example shows the addition of days and hours across winter/summertime change
in_utc = date.to.utc(2002,3,29,13,30,0)
res = utc.add( in_utc, 0, 0, 1, 24, 0, 0, ou_utc )
The result in timezone "Europe/Amsterdam" is: ou_utc=1017577800, res = 0 (that is 2002.3.31 14:30:00)
This example shows the addition of days across winter/summertime change
in_utc = date.to.utc(2002,3,29,13,30,0)
res = utc.add( in_utc, 0, 0, 2, 0, 0, 0, ou_utc )
The result in timezone "Europe/Amsterdam" is: ou_utc=1017574200, res = 0 (that is 2002.3.31 13:30:00)
This example shows the substraction of 1 month from March 31st, 2000.
in_utc = date.to.utc(2000,3,31,9,0,0)
res = utc.add( in_utc, 0, -1, 0, 0, 0, 0, ou_utc )
The result in timezone "Europe/Amsterdam" is: ou_utc=951811200, res = 1 (that is 2000.2.29 9:0:0)
Regards
sakthi kj
23rd July 2018, 07:07
Thanks for your idea...…………..:)
sakthi kj
25th July 2018, 08:30
how to check the seconds in utc.num()..????? :-(