Find number of days in current month

Hi Folks ,
I needed some help in knowing the number of days in any month ... I need to develop an application which will be triggering a mail with an excel attachment at the end of every month ...after populating the excel sheet from an Oracle database ..
Kindly help...
Thx..

Thx a lot for your immediate reply .. I tried using
the calender class. But for my application .. i need
to automate this process by sending a mail every last
day of the month... but i am finding it a bit
difficult to really automate setting the current
month to the Timer class
Timer timer;
     public Reminder ( int seconds ) { 
          timer = new Timer ( ) ;
timer.schedule( new RemindTask ( ), seconds*1000
000 ) ;
     }The Calendar class is still the best solution IMHO.

Similar Messages

  • Number of days in current month

    Hi all,
    I have a reporting situation, where I need to calculate the total
    number of days in the currrent month based on system date/calender date. Do we have a standard function to return this value? Or any
    variable? Or if you have done something similar, please let me know.
    This is what I need. If today is July 28, then I need the value 31 to be returned. If its February, 28 or 29 dependinng on whether its leap year or not. I want to use this value to calculate other values.
    Any help appreciated Guys !!!

    LAST_DAY_IN_PERIOD_GET should get you started..
    Good Luck

  • How to get total number of days in current Fiscal period/year

    Hi,
    I need to get total number of days in current Fiscal period/year (current month) and assign it to an infoobject. I need a routine for this. Is there any function module to get this.If possible pls paste the ABAP code also for this task. Thanks in advance

    here is the FM:
    LAST_DAY_IN_PERIOD_GET
    KJ!!!

  • How to get the first day of current month

    hi guys,
    i am trying to get the first day of current month which get from the date i input at the selection screen. my method is not so good, so i was wondering if there is better way to get the this,
    thanks.

    Try this .
    data : DAYNR LIKE  HRVSCHED-DAYNR,
         DAYTXT LIKE  HRVSCHED-DAYTXT.
    data langu like sy-langu value 'EN'.
    Parameters PDATE LIKE SY-DATUM.
    PDATE+6(02) = '01'.
    CALL FUNCTION 'RH_GET_DATE_DAYNAME'
      EXPORTING
        LANGU                     = LANGU
        DATE                      = PDATE
      CALID                     =
    IMPORTING
       DAYNR                     = DAYNR
       DAYTXT                    = DAYTXT
      DAYFREE                   =
    EXCEPTIONS
      NO_LANGU                  = 1
      NO_DATE                   = 2
      NO_DAYTXT_FOR_LANGU       = 3
      INVALID_DATE              = 4
      OTHERS                    = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    WRITE :/ PDATE, DAYNR, DAYTXT.
    Cheers

  • SSAS Tabular - return number of days in given month using month's start date?

    Is there a way to return the number of days in a month by providing just the month date or month start date?
    We have a time table, but it is at monthly (not daily) granularity.
    So I can't just count rows between start/end of month.
    I need to be able to divide by the number of days in a given month and can't seem to find a way to get number of days in that given month.
    Thanks!

    Hi,
    According to your description, you want to get the number of days in a month with the month's start date, right?
    In this case, we can get the first day of next month using DateAdd function, and then use DateDiff function to calculate the number of days in this month. Here is a sample query for your reference.
    WITH
    MEMBER Measures.Today AS vba!Now()
    member measures.FirstDayOfNextMonth as dateadd("m",1,Measures.Today)
    member measures.daysnumber as datediff("d",Measures.Today,measures.FirstDayOfNextMonth)
    select Measures.daysnumber on 0
    from
    [Adventure Works]
    Reference
    http://msdn.microsoft.com/en-us/library/hh510163.aspx
    http://office.microsoft.com/client/helppreview14.aspx?AssetId=HV080007558&lcid=1033&NS=EXCEL%2EDEV&Version=14&tl=2&pid=CH080007543
    http://office.microsoft.com/client/helppreview14.aspx?AssetId=HV080007559&lcid=1033&NS=EXCEL%2EDEV&Version=14&tl=2&pid=CH080007543
    Regards,
    Charlie Liao
    TechNet Community Support

  • How To Split One Record  into 30 Records(Number of days in a Month)

    Hi Experts,
      we are getting the montly(yearmonth) Forecast data from flat file we need to generate the report which shows the daily Forecast data,
    For example for the month of June Forecast we have  150EA.
    Flat file data is like this
      0calday    Qty
      201006     150
    we need to show the report like datawise
       Calday                                     Forecast qty
    20100601                                          5
    20100602                                          5
    20100603                                          5
    20100604                                          5
    20100605                                          5
    20100606                                          5
    20100630                                           5
    its like month forecast / Number of days in a month.
    we can achive these  in two ways as per my knowledge
    1. At the time loading data
    2. Reporting level
    Which is the best way
    how can we achive this.
    Thanks
    Chandra

    Hey.  There was a similar posting I gave a suggestion on a while back.  Here is the link...
    Re: Spliting records into cube
    As far as the correct time of doing this, I would definitely do this at the time of data load and not time of reporting. 
    Hope you find it helpful.
    Thanks

  • How do I find the start day of each month

    Hi all,
    Hope someone can give a a hand here I've to do a calender project for college and I'm not allowed to use any built in Java classes so fun all the way so far :-)
    I've got one question that is bugging me at the moment. and that is how to find the start day for each month in a year and store them in an array.
    I'm starting my week at Monday (0) and stopping at Sunday (6) and I do have a formula for discovering the first day in Jan of the given year its
    ((y-1900)*365 + (y-1901)/4)%7
    I was just wondering how I could amend this to find the first day in Feb, March etc.
    Any suggestions greatly accepted.
    Thanks in advance.

    Irish-Student wrote:
    newark maybe I didnt make clear exactly what I want to do.
    I have each day of the week starting at 0 for Monday up to 6 for Sunday I want to map what the start day of a month as a number between 0 and 6.
    The formula I have discovering the first day of Jan of a given year will give you 1 i.e. Tuesday
    what I need to do is find out what number between 0 and 6 the start day of each other month of a given year is.
    For example the 1st of Feb is a Friday which is 4 on the weekday map.
    Your suggestion of 31%7 won't work for this, sorry more than likely my fault for not being clearer in what my requirements were.
    Cheers for the help so far and yep your right not being able to use the built in classes is a pain :-)
    Edited by: Irish-Student on 03-Mar-2008 20:01This doesn't really change much of my first suggestion. If you can already calculate the first day of the month of January for any given year, then there's no problem figuring out the other months. Say I want to know the first day April 1, 1978. You already know how to find January 1, 1978. So find that. Then find the number of days between January 1 and April 1 (remember to account for leap years). Once you have the number of days, you can figure out how many weeks and days that is, and thus what day of the week it is.

  • Report for current day and current month

    Hi gurus,
    i 've a report, where i 've to display the values for qty and cost of the material for the current day and current month
    HOw can i do this in BEx Query designer..If any document plz share
    thanks
    rakesh

    hi Kolli
    here i want to filter the data on system date,
    i wnt the report to pick the date dynamically based on the system date.
    but i think restricting on calmonth and calday is not going to solve my scenario..
    rakesh

  • Current day and no of days in current month

    Hi all,
    can anbody tell me which object is used for current day and no of days in current month.

    Hi,
    USe /OSP/GET_DAYS_IN_MONTH Function Module, just give Date you will get No. Of days in that Month.
    Use SY-DATUM for current date.
    Ex:
    Data: dt type SY-DATUM.
    dt = SY-DATUM.
    so you get current date in dt.
    Thanks
    Reddy

  • Date for first day of current month

    How can i get the date for first day of current month ?

    select trunc(sysdate,'MM'),to_char(trunc(sysdate,'MM'),'DD'),to_char(trunc(sysdate,'MM'),'Day') from dual;

  • First day of current month, one year ago

    All,
    Does anyone have a calculation or know how I can calculate the first day of the current month, one year ago? I am trying to setup a filter criteria to show all records created >= 1st day of current month for prior year and <= the last day of the prior month. I have the second half of the equation for last day prior month but need some help on the first half.
    Thanks in advance for any pointers!
    D

    You can try:
    SELECT TRUNC(ADD_MONTHS(sysdate, -12), 'MON') FROM dual;
    Or
    SELECT TRUNC(sysdate-NUMTOYMINTERVAL(1,'YEAR'), 'MON') FROM dual;

  • Show data of last day of previous month against any day of current month

    Hi,
    I have fact table which contains data at date level (we have data for oct-2009 to april-2010). Our requirement is to show data of last day of previous month against any day of current month in obiee 11g. I am facing problem in Feb 2010 its picking data of 28-Jan-2010 instead of 31-jan-2010 and for April its picking data of 30-mar-2010 instead of 31-mar -2010.
    Any suggestion ???

    You're asking to filter your data set to only include rows between:
    1) last day of the previous month
    2) any day of the current month
    This can be achieved with prompting in OBIEE Answers.
    last day of previous month = TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE)) . The problem is you need to make query work within Oracle's Answer syntax.
    In the prompt, select the operator type for your date dimension as 'between' and default to 'SQL Results'.
    For the 'last day of previous month' , use the query:
    SELECT
    case when 1=0 then Time."Fiscal Date" else TIMESTAMPADD( SQL_TSI_DAY , -(1), TIMESTAMPADD( SQL_TSI_DAY , DAYOFMONTH( CURRENT_DATE) * -(1) + 1, CURRENT_DATE))
    end
    FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
    For the current date, use the query:
    SELECT
    case when 1=0 then Time."Fiscal Date" else CURRENT_DATE
    end
    FROM ENTER_YOUR_PRESENTATION_FACT_FOLDER_HERE
    Another option is to create a last_date_pervious_month variable in the RPD and have that as the default value in your prompt.

  • Number of days in a month - 0CALDAY

    Hi,
    I have a query where I am calculating the average daily sales for each month. For this I need to know the number of days in each month. How can I do this? For instance, it should give 31 for Jan, 28/29 for Feb, 31 for Mar and so on. I am using OCALMONTH as the input variable.
    Thanks for your help.
    Uday

    Hi Uday,
    I have a few modifications in the code
    Data: xdate type d,
          ip_year(4) type N,
          ip_month(2) type N.
    Types : Begin of ty_month_days,
           month(2) type N,
           days(2) type N,
           End of ty_month_days.
    Data : it_month_days type ty_month_days occurs 0 with header line.
    ip_year = 2006.
    ip_month = 01.
    do 12 times.
        CONCATENATE ip_year ip_month '01' INTO xdate.
        xdate = xdate + 33.       "this date is in the next month
        xdate+6(2) = '01'.        "first day of next month
        xdate = xdate - 1.        "last day of xmonth
        it_month_days-month = xdate+4(2).       "number of days of xmonth.
        it_month_days-days = xdate+6(2).
        append it_month_days.
        ip_month = ip_month + 1.
    enddo.
    This code stores Month and No. of days in the internal table it_month_days.
    You can access this internal table for your calculations
    This should help.
    Regards,
    Praveen.
    Message was edited by: praveen mathew

  • Calculated item divided by number of days in a month

    Hello.
    I'm trying to create a calculated item, that is supposed to represent a column member, divided by the number of days in a month that's selected from the dashboard prompt.
    I know that I need an SQL function to get the number of days, but I don't think that you can use SQL functions when creating calculated items.
    Is there a way to do this?

    Looks like you are thinking too much
    Use expression builder in the rpd and then just use available functions without 2nd thought.
    if helps mark

  • Calculate the number of days in a month

    I need to do a calculation in my query based upon the number of days in the month. The report is broken down by cal year / month.
    Is there an easy way of identifying these values in the query?
    Regards.

    Hi,
      This can be done by writing an user exit code to determine the number of days in the month.
    Sample Code :
    <
    CHECK i_step = 2.
      READ TABLE i_t_var_range WITH KEY vnam = 'XXXX'
                               INTO loc_var_range.
      IF sy-subrc EQ 0.
        beg_date(6) = loc_var_range-low(6).
        end_date(6) = loc_var_range-low(6).
        beg_date+6(2) = '01'.
        end_date+6(2) = '01'.
        ADD 1 TO end_date+4(2).
        IF end_date+4(2) = '13'.
          end_date+4(2) = '01'.
          ADD 1 TO end_date(4).
        ENDIF.
        no_days = end_date - beg_date.
        l_s_range-sign = 'I'.
        l_s_range-opt  = 'EQ'.
        l_s_range-low  = no_days.
        APPEND l_s_range TO e_t_range.
      ENDIF.
    >
    Hope this helps..
    Thanks & Regards,
    Pradeep

Maybe you are looking for