Date: getYesterday? get LastWeek?

Èllow Chaps!
      I've really searched. I am creating a button that actually gives me yesterday's date (simply put solving this problem for General use) is to display Yesterday's date in this format: YYYY-MM-DD
I will show you my code, and surely you'll notice this won't work, and is buggy, but I've tried:
// Gets todays date and removes the days (offset)
private function todayDay(offset:Number = 0):String {
     if ((_date.getDate()) < 10) {
             // checking is < 10 to add a 0 for single digit days... example: November 1 = 11-01
             trace("return: " + String("0" + Number(_date.getDate() + offset))); // Err: OFFSET may reduce the date to a negative day
          return String("0" + Number(_date.getDate() + offset));
          } else {
                    trace ("return 2: " + String(_date.getDate()));
              return String(_date.getDate());
An Example using this function would be like so:
initialDate = String(_date.getFullYear()) + "-" + todayMonth() + "-" +  todayDay(-7);
Now you could see the problem with this, is that if we are on the 4th of November, the date could be a - (minus) if the offset is -7 days.
Is there a way I could create a function that returns me a date in the format YYYY-MM-DD by calling a function that gets me todays date and removes the offset days. (the months and day would also apply: ex: -10 days from the 2009-11-07 would return 2009-10-28

Hi,
You can subtract 24 hours from the date object to get the previous day's date and subtract 24 * 7 to get the previous week's date.
Once you get the new date, you can use DateFormatter to format it in any format.
Check these methods
private function getPreviousDay(date:Date):Date
     date.hours = date.hours - 24;
     return date;
private function getPreviousWeek(date:Date):Date
     date.hours = date.hours - 24 * 7;
     return date;
Using date formatter
var df:DateFormatter = new DateFormatter();
df.formatString = 'YYYY-MM-DD';
var dateString:String = df.format(date);

Similar Messages

  • I'm in cycle mode, and 'merge' is clicked in preferences. However, when I record, my previous track data keeps getting overwritten. Does anyone know what I'm doing wrong. Interestingly, I can still see the data in the region.

    I'm in cycle mode, and 'merge' is clicked in preferences. However, when I record, my previous track data keeps getting overwritten. Does anyone know what I'm doing wrong. Interestingly, I can still see the data in the region.

    jamestait wrote:
    when I record, my previous track data keeps getting overwritten.
    since you didn't specify, are you recording in a single take?
    http://www.bulletsandbones.com/GB/GBFAQ.html#multipassrecording
    (Let the page FULLY load. The link to your answer is at the top of your screen)

  • Data not getting uploaded in the AQ table.

    Hi All
    We have one issue with the AQ tables.
    The scenario is like we first send data from Oracle to SOA and then to a third party tool.
    For this we first populate data in one custom payload table and then in to one custom AQ table.
    Now the data is getting updated in the paylaod table and XML is getting generated, but it is not getting interfaced to the third party tool.
    Reason : Data is not getting populated in the custom AQ table from where SOA picks the data and interfaces it ti the third party tool.
    Error is a custom one :
    While equeing the data using the below statement
    l_chr_corrid := p_in_event.getvalueforparameter ('CORRID');
    since the CORRID Id is null it gives us the message :Correlation ID has not been set for the payload.
    Part of the code for setting WF parameters :
    l_chr_corrid_val := l_chr_event_name || '.order';
    wf_event.addparametertolist (p_name => l_chr_corrid_name,
    p_value => l_chr_corrid_val,
    p_parameterlist => l_param_list
    l_local_event.setcorrelationid (l_chr_corrid_val);
    l_chr_rule_ret := wf_rule.default_rule (p_in_subscription_guid, l_local_event); -- Returns success
    This is quite urgent , hence kindly help us find a sollution to this issue.
    Thanks in advance
    Trupti

    Looks like you havent populated the correlation id. To make sure this is unique use the conversationID, or GUI, etc.
    Not sure what version you are on. If 10g look at this note (obviously chnage from file to AQ, concept the same):
    http://middleware1.wordpress.com/category/adapters/page/2/
    If 11g you should be able to see the property when you edit the invoke activity, there is a tab called properties.
    cheers
    James

  • In VA01  In Schedule line Delivery date not getting populated

    Hello,
    We have developed enhancement for VA01 tcode.
    Depending upon the quatity entered for a material it should show one more item as free good.
    If quatity is 10 for a line item 10 then it should show item 20 by default same mateerial and quatilty as 1.We have done this it is working fine.
    But if we select free good item in our case it is 20 and click on schedule line item buttom all quaitity fields getting populated.but delivery date not getting populated for only free good.for line item 10 it showing properly.
    Can any one please suggest what i need to do in order to display delivery date for free good.
    Thanks in advance.
    Regards.

    Thanks for your response.
    Actually i have seen technical settings for that field.it is rv45a-etdat.this field has value till MV45AFZZ.seen in debugger.
    Looks like it is clearing some where after the above include.Any suggisitions welcome.Thanks again.

  • Data not getting populated in Payslip in ESS Portal

    Hi All
    I am tryig to display Payslip in Portal. Have done all the necessary configuration in Benefits and payments->Salary statement->HRFOR/ EDTIN features.
    Correct Payslip form is visible but data is not getting populated in the payslip.
    Have tested the Payslip in PC00_M40_CEDT transaction with the variant i have set for HRFOR/EDTIN features and Payslip data is displayed correctly.
    Have checked for PZ11_PDF transaction but i get a message saying it cannot be accessed through Easy access.
    Can anyone pls let me know what might be the reason for data not getting populated in Payslip in Portal?
    what is role of PZ11_PDF transaction in Payslip display in Portal?
    Regards
    Asha

    Hello,
    Do one thing for executing the PZ11_PDF trsaction please follow following steps.
    1. Once you log in SAP system with same User - Id which you r using on Portal .
    Once log in PUT "/N" in the command box . Then put the trasaction "PZ11_PDF" and execute it will
    Call the salary statement .
    Or
    Once you log in SAP system put the trasction "/nsbwp" then give the trasaction "PZ11_PDF" it will
    call the salary statement ..
    give inputs once you done
    .....The issue with  Authorisations please check it ...
         Add this object in ESS role "S_SERVICE' ...
        and this object in ESS role "P_PERNR" ---infotype 0008
    Edited by: Vivek D Jadhav on Jun 15, 2009 11:49 AM

  • Data not getting populated in ESS Payslip in portal

    Hi All
    I am tryig to display Payslip in Portal. Have done all the necessary configuration in Benefits and payments->Salary statement->HRFOR/ EDTIN features.
    Correct Payslip form is visible but data is not getting populated in the payslip.
    Have tested the Payslip in PC00_M40_CEDT transaction with the variant i have set for HRFOR/EDTIN features and Payslip data is displayed correctly.
    Have checked for PZ11_PDF transaction but i get a message saying it cannot be accessed through Easy access.
    Can anyone pls let me know what might be the reason for data not getting populated in Payslip in Portal?
    what is role of PZ11_PDF transaction in Payslip display in Portal?
    Regards
    Asha

    Asha,
    Maintain Feature EDPDF which determines the SMARTFORM being used to make the payslip available for employees. This is more of a HR related issue and I believe if you post this in the ESS or HR Forum you would be able to resolve this issue.
    Good Luck!
    Sandeep Tudumu

  • Data not getting inserted in R/3 System from Webdynpro

    Hi,
    We were trying to insert some data into r/3 z-table using a Custom BAPI using RFC.
    But the data is not getting inserted.
    Through I commit is being performed explicity.
    Please help:
    Below is the code :
    Controllor code :
    public void wdDoInit()
        //@@begin wdDoInit()
         try{
            Z_Bapi_Rfq_Test_Input objStatus = new Z_Bapi_Rfq_Test_Input();
            wdContext.nodeZ_bapi_rfq_test().bind(objStatus);
    //        Create a new element in node Bapi_Transaction_Commit_Input
          Bapi_Transaction_Commit_Input inputCommit =
          new Bapi_Transaction_Commit_Input();
          wdContext.nodeBAPI_TRANSACTION_COMMIT()
          .bind(inputCommit);
            //Bapi_Transaction_Commit_Input obj;
           // wdContext.nodeZ_Bapi_Quo_Salesrep_Status_Input().invalidate();
            //wdContext.nodeOutput().invalidate();
            //wdContext.nodeRfq_Status().invalidate();
              } catch(Exception rfqException){
                        wdComponentAPI.getMessageManager().reportException("rfqException="+rfqException.getMessage(),true);
        //@@end
    public void executeBapi( )
        //@@begin executeBapi()
         try{
                   Z_Bapi_Rfq_Test_Input  obj = wdContext.currentZ_bapi_rfq_testElement().modelObject();
                   AbstractList   objAbBapiPartner = new Bapiparnr.Bapiparnr_List();
                   Bapiparnr objBapiPartner = new Bapiparnr();
                   objBapiPartner.setPartn_Numb("0000001046");
                   objBapiPartner.setPartn_Role("AG");
                   //obj.addPartner(objBapiPartner);
                   objAbBapiPartner.add(objBapiPartner);
                  obj.setPartner(objAbBapiPartner);
                  Bapisdhd1 objBapisdhd1 = new Bapisdhd1();
                   objBapisdhd1.setSales_Org("2500");
                   objBapisdhd1.setDistr_Chan("30");
                   objBapisdhd1.setDivision("20");
                   objBapisdhd1.setDoc_Type("ZRFQ");
                 obj.setHeader(objBapisdhd1);
                 obj.execute();
    //             Synchronise the data in the context with the data in the model
                   wdContext.nodeZ_bapi_rfq_test().invalidate();
              wdContext.nodePartner().invalidate();
                   wdContext.nodeHeader().invalidate();
                   wdContext.nodeOutput().invalidate();
                   wdContext.nodeReturn().invalidate();
    //               Z_Bapi_Quo_Salesrep_Status_Output outPut= obj.getOutput();
    //               if(outPut!=null){
    //                    List materialList=outPut.getRfq_Status();
    //                    if(materialList!=null){
    //                      wdComponentAPI.getMessageManager().reportSuccess("materialList="+materialList.size());
              } catch(Exception rfqException){
                   wdComponentAPI.getMessageManager().reportException("rfqException="+ rfqException.toString(),true);
        //@@end
    public void executeBapi_Commit( )
        //@@begin executeBapi_Commit()
         try {
    //       Calls remote function module BAPI_Transaction_Commit
         wdContext.currentBAPI_TRANSACTION_COMMITElement().modelObject().execute();
         wdContext.nodeBAPI_TRANSACTION_COMMIT().invalidate();
         wdContext.nodeOutput1().invalidate();
         wdContext.nodeReturn().invalidate();
         wdContext.nodeReturn1().invalidate();
         } catch (WDDynamicRFCExecuteException ce) {
              wdComponentAPI.getMessageManager().reportException(ce.getMessage(), false);
        //@@end
    View Controlloer Code:
    public void wdDoInit()
        //@@begin wdDoInit()
         wdThis.wdGetCControllerController().executeBapi();
         wdThis.wdGetCControllerController().executeBapi_Commit();
                 IWDApplication wedDynApplication=wdComponentAPI.getApplication();
                 IWDApplicationInfo applicationInfo=wedDynApplication.getApplicationInfo();
                 Collection collection=applicationInfo.getApplicationProperties();
        //@@end

    Hi Gareth,
    I was not getting enough time to reply, so replying late.
    Actaully the problem was with r/3 BAPI Code itself.
    There was condition in the begining of the code to check the data in the workare of R/3, so this condition was failing here.
    But when we try to invoke that bapi from r/3 workbench it works fine because the data first comes to R/3 workarea then to R/3 Tables.
    But when we insert data from Webdynpro framework , the data directly goes to R/3 Tables rather than the R/3 Workarea. So in Bapi the first condition was failing and no data was getting inserted.
    So this was the problem, and we solved it.
    Thanks,
    Regards,
    Aditya metukul

  • Data not getting fetched from Quotation to Contract

    Hi,Myself new to TM. I have a ticket mentioning data not getting fetched from quotation to contract. How to solve it? Please help...
    Message was edited by: Michael Appleby

    Please add the version of the TM product and which SPs have been installed.  Also more information on the quotation and contract.
    What do you mean by ticket?  It you mean an error message, from where are you reading the message?
    Regards, Mike
    SAP Customer Experience Group - CEG

  • Contact person Rel.ship Data not getting updated in B2B Web User Mngt

    Hi CRM Gurus,
    Need some help on Web User Management functionality.
    Sub: Contact person Relationship data not getting updated when we change the company (to wich contact person belong to) in ISA CRM 5.0 Web User Management.
    we are currently on CRM ISA 5.0 and using Web User Managment for our B2B scenario. New creation of users is working fine. But when we want to change the company (Sold to pary) for the existing contact person, the relationship data in CRM is not getting updated and the below are the details.
    Contact person No: XXXX (has a Relationship: "Is contac person for YYYY company in CRM)
    Company/Sold to Party: YYYY (has a relationship "Has contact person XXXX in CRM).
    When I chage the contact person's (XXXX) company  from  YYYY to ZZZZ,
    - Relationships of the new assignment for ZZZZ in CRM not getting updated.
    - Old Records in YYYY is not getting deleted (i.e. relationships.
    - There is No relationship data appear in XXXX.
    Appreciate any inputs on the same.
    Thanks,
    Rahul >>>

    Hi Rahul,
    I'd suggest you running a session trace / ABAP debugging to see if some information is not getting passed from the Java stack onto the ABAP stack. An alternate move would be to create a new OSS customer message.
    Cheers,
    Ashok.

  • I need to rebuld the "C" drive on my computer will need to reinstall adobe cs6 when I am done, but have moved recently and lost the data to get that done. Help!

    I need to rebuld the "C" drive on my computer will need to reinstall adobe cs6 when I am done, but have moved recently and lost the data to get that done! Help!

    Downloads available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  13 |12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  13 |12 | 11, 10 | 9,8,7
    Lightroom:  5.7| 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.window using the Lightroom 3 link to see those 'Important Instructions'.

  • Cell data not getting refreshed in which user enters data OO ALV(editable)

    Hi Friends,
    I am using OO ALV for editable grid display.
    I am unable to change grid data in the cell in which user enters something, using OO ALV. Did through debugging of my own program and found that some problem with system program. Then I did all system debugging. Could not find out why is the grid not getting refreshed with the new data in the cell in which user had entered some value. Rest of the cell's data are getting refreshed with the values which i am updating in the final internal table. I can see that the data in the final internal table is changed for the cell in which user enters data. But even after the call of
          CALL METHOD obj_alvgrid1->refresh_table_display
    does not refreshes the data in the cell in which user had entered data. Rest of the cells data are getting refreshed.
    Piece of code:
      SET HANDLER obj_event_receiver->handle_data_changed
                                         FOR obj_alvgrid1.
        METHODS: handle_data_changed
                       FOR EVENT data_changed OF cl_gui_alv_grid
                           IMPORTING er_data_changed
                                     e_onf4
                                     e_onf4_before
                                     e_onf4_after.
    METHOD handle_data_changed.
      DATA : v_valid    TYPE char1,
             v_refresh  TYPE char1.
    *--check mt_good_cells semantically
      CALL METHOD perform_semantic_checks( er_data_changed ).
    *--If PBO is again visited, just refresh the ALV grid.
      CALL METHOD obj_alvgrid1->refresh_table_display
        EXCEPTIONS
          finished = 1
          OTHERS   = 2.
      IF sy-subrc <> 0.
        EXIT.
      ENDIF.
    ENDMETHOD.
    METHOD perform_semantic_checks.
        LOOP AT er_data_changed->mt_good_cells INTO w_good.
          v_index = sy-tabix.
          CASE w_good-fieldname.
            WHEN 'ZASCAS'.
    *Now here based on some conditions I am changing my final internal table i_zamtsmatnp
                              MODIFY i_zamtsmatnp FROM w_zamtsmatnp INDEX
                                               w_good-row_id TRANSPORTING
                                                 zascas modif.
    User enters data in zascas field. Based on the data entered, I am changing other fields which is getting refreshed. I am also changing zascas in the program even after user had already entered the value which was bit wrong and i am correcting it in the program on the even "data_changed" even.
    Please help me friends as i m strugling past hours wondering why the data is not getting refreshed for the cell in which user enter data.
    Regards,
    Surya

    Hi Surya,
       The approach you are following is correct. You need to use the comibnation of all these things:
    Event - DATA_CHANGED
    Methods - CHECK_CHANGED_DATA
                 -  GET_CHANGED_DATA.
    However, here are few standard programs which are having similar functionality.
    BCALV_EDIT_03
    BCALV_EDIT_07
    Check out these once.
    Note: If anything is helpful, dont forget to reward points
    Thanks,
    Adithya K
    SAP Practise
    [email protected]

  • Adhoc Query data not getting displayed on Portal

    Hi,
    I have a problem with custom Adhoc query data not getting displayed on the portal.
    It was getting displayed initially but after a user made some changes to the query its not getting displayed.
    The query is displaying data perfectly on R/3 but on portal ..Its giving the message no data found.
    Can anyone help me on this.
    Also if anyone can tell me how do i debug an Adhoc query from potal.
    Is there any tool to debug an Abap program from portal.
    I dont want to use trace,
    Thanks
    GT
    Message was edited by: GT

    Hi GT
    find out the EXACT query u want to launch if it's display
    in BW buisness explorer then change the iview property
    for that query in portal . right click on iview
    BEx Web Application Query String -> assign correct query
    regards,
    kaushal

  • Data should get inserted in all tables if i enter the form field only once

    Hi, I have a new question again.
    There are 5 tables in a database, that is t1, t2, t3, t4 & t5. the first 4 table has one common column, known as lc_no. I have build the form using the form builder. In that form, there is a 1 text field for lc_no. I have not started to code anything as yet in the form because everything with respect to it is working fine and even the data is getting inserted. But the problem is that, when i enter the data in the form, the lc_no gets loaded in only one table. I want the data to get inserted in all the tables. What should i code? How should i start off? I'm very new to this & don't exactly know how do i start with it ?
    Thank You. Can you help as i have not yet started to code in this form.
    Oracle9i Enterprise Edition Release 9.2.0.1.0.
    oracle forms 6i.

    Let us say table one have lc_no, other columen
    Table 2 have LC-no , other columsn
    Table 3 have lc-no , other column,
    Now in form(which has table1 as base table)
    In PRe-Insert write like below
    Insert into table2 (lc_no) values (:table1.lc_no) here tabel1 should be block name in form.
    Insert into table3 (lc_no) values (:table1.lc_no)
    ................and so on .. to other table.
    So, now when user commits the form, the lc_no will be available in all the other tables..

  • How do I store 4 hours of data and get it out of the "while loop" into a spreadshee​t file for documentin​g purposes? "See additional Text for additonal info"

    What a have is a VI that uses the following SUbvi's, starts with FP OpenVI, then FP Create TagVI, into a "While Loop" which contains a FP ReadVI outputting data into a Index ArrayVI outputting to a Display (DBL). This shows the output of a FP-AI-100 monitoring a 9v battery. I have to monitor this battery for a 4 hour period my problem is storing the 4 hours of data and getting it out of the "while loop" into a "Write to Spreadsheet File VI" all I seem to accomplish is just one data sample which I get into a spreed ship file with no problem. I just can't get 4 hours worth. By the way this is my first VI and I'm self
    trained so have mercy.

    I figured it out thanks.
    John Morris
    Glendinning Marine

  • How do I store 4 hours of data and get them out of the "while loop" into a spreadsheet file for documenting purposes? "See additional Text for additonal info"

    What a have is a VI that uses the following SUbvi's, starts with FP OPENvi, then FP Create Tagvi, into a "While Loop" which contains a FP READvi outputting data into a INDEX ARRAYvi outputting to a Display (DBL). This shows the output of a FP-AI-100 monitoring a 9v battery. I have to monitor this battery for a 4 hour period my problem is storing the 4 hours of data and getting it out of the "while loop" into a "Write to Spreadsheet File vi" all I seem to accomplish is just one data sample which I get into a spreed ship file with no problem. I just can't get 4 hours worth. By the way this is my first VI and I'm sel
    f trained so have mercy.

    I figured it out Thanks.
    John Morris
    Glendinning Marine

  • Why does my Infinity date keep getting put back

    Hi I am wondering if somebody can tell me why my Infinity due date kees getting put back.  I was originally told it would be in my area last year, then by Sept 2013, then the end of the year, then Feb/Mar 2014 then The end of Mar then low and behold today it is beween Mar to June 2014. 
    I can understand some delays but the variation of these dates is ridiculous I feel BT are picking dates out of the air to stop customers moving elswhere.  I am relly fed up waiting and being strung along with ficticious dates and promises. 
    I have seen engineers working in the Bt boxes in my area for many months.
    As for signing up for information on Infinity from BT that is a Joke I signed up for that 2 years ag and have so far had not one single bit of information of any kind from them.  I would have expected some feedback on how well the roll out is going etc to encourage potential customers of the benefits etc.  very very poor customer service on this front I feel

    This is a BT Retail residential customer to customer forum. The problem of dates changing is an Openreach responsibility and not BT Retail.
    There are various reasons for this to happen such as planning permission for cabinets, power supplies and commercial reasons.
    Up until recently you could email Openreach and ask when your cabinet was likely to be upgraded however Openreach are no longer giving out that information, instead they are replying:-
    Thank you for your contact to us. Please note that we will not be responding to you by email but, would like to point you to the Openreach Superfast Fibre website and the FAQ section that will provide answers to the most commonly asked questions. It will also provide links to those service providers that sell fibre broadband at the moment so you can check if your particular line is enabled.
    http://www.superfast-openreach.co.uk/where-and-when/
    So in short, you just need to keep checking to see if your cabinet has been up graded.
    If you use this checker it will tell what cabinet you are on and what services it can receive
    http://www.dslchecker.bt.com/adsl/adslchecker.welcome

Maybe you are looking for

  • Certain songs won't transfer to iPod

    Ok, this is bugging the crap outta me. A few days ago, my iPod Classic kinda went on the fritz. For some reason, the sound became all distorted. So I tried restoring it. That didn't fix the problem. In fact, it made things worse, because after I rest

  • LCD monitor is grainy & red. please help!!

    Hello! I have a Macbook from Christmas '06. I recently upgraded to Snow Leopard.... I used to hook my computer up to my TV, but after upgrading it has grainy red lines in the dark areas of the screen. I just bought a new LCD/LED lit monitor and am ha

  • White screen with apple logo and rotating cog

    Is this a sign that my 27inch imac is overheating. Do I have enough ventilation around it? how much space should I have around the outside of my mac?

  • Converting dos line endings to unix

    What is the simplest way a Macintosh user can convert a text file with DOS/Windows (CRLF) line endings to Unix/Mac (LF) using only the tools available in a standard OS X distribution? In the command-line environment (Terminal), I don't see the old st

  • Unicode convertible, what does it mean?

    TYPES: BEGIN OF zbficheentry_list2, FICHENO type zbficheentry-ficheno, LOGISTICSCENTER type zbficheentry-logisticscenter, KANTARNO type zbficheentry-kantarno, TRDATE type zbficheentry-trdate, TRHOUR type zbficheentry-trhour,  line_color(4) type c, EN