1. #1
    Ext User
    Join Date
    May 2009
    Posts
    9
    Vote Rating
    0
    giovannotti is on a distinguished road

      0  

    Default Get Months

    Get Months


    I would like to know if is possible to get the current month and the two previous ones with ext?

  2. #2
    Ext User javarine's Avatar
    Join Date
    May 2008
    Posts
    21
    Vote Rating
    0
    javarine is on a distinguished road

      0  

    Lightbulb Getting months

    Getting months


    I'm sure you can do that with just plain ol' javascript.

    Var d = new Date();

    var month = d.getCurrentMonth();

    var last_month = month -1;

    var month_before_last = month - 2;

    Some code like that should get you what you want....

  3. #3
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    35
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    And what if the "month" was 0?

    last_month -1? OK?

    http://extjs.com/deploy/ext-3.0-rc1....ate&member=add

  4. #4
    Ext User javarine's Avatar
    Join Date
    May 2008
    Posts
    21
    Vote Rating
    0
    javarine is on a distinguished road

      0  

    Thumbs up some month function thingy

    some month function thingy


    I'm sure you can write some custom function to handle that.

    Code:
     
    function workTheMonths(month){
          if(month == -1){
               return 12;
          }
          else if(month == -2){
               return 11;
          }
     
    }

  5. #5
    Ext User
    Join Date
    May 2009
    Posts
    9
    Vote Rating
    0
    giovannotti is on a distinguished road

      0  

    Default


    throws d.getCurrentMonth is not a function

    if the current moth = 0, the value to show for the past month must be 11.

  6. #6
    Ext User javarine's Avatar
    Join Date
    May 2008
    Posts
    21
    Vote Rating
    0
    javarine is on a distinguished road

      0  

    Thumbs up getMonth should do the trick

    getMonth should do the trick


    Oh, yeah.
    d.getMonth() is the javascript function.


    function whatIsLastMonth(month){
    var last_month = month - 1;

    if(last_month == -1 )
    return 11;

    }

    You can do the same thing for the month before last.
    Happy coding

  7. #7
    Sencha - Ext JS Dev Team Animal's Avatar
    Join Date
    Mar 2007
    Location
    Notts/Redwood City
    Posts
    30,483
    Vote Rating
    35
    Animal has a spectacular aura about Animal has a spectacular aura about

      0  

    Default


    Mmmm yeah. Real lot of point to that.

  8. #8
    Ext User javarine's Avatar
    Join Date
    May 2008
    Posts
    21
    Vote Rating
    0
    javarine is on a distinguished road

      0  

    Talking All i can offer, i offer to y'all

    All i can offer, i offer to y'all


    Thanks Nige:
    It is my pleasure to spread the gospel of javascript according to Ext.
    Catcha...

  9. #9
    Ext User
    Join Date
    May 2009
    Posts
    9
    Vote Rating
    0
    giovannotti is on a distinguished road

      0  

    Default


    Thanks, that work perfect

  10. #10
    Sencha User
    Join Date
    Mar 2007
    Posts
    13
    Vote Rating
    0
    iamakimmer is on a distinguished road

      0  

    Default


    isn't this cleaner?

    var d = new Date();
    console.info(d.format('n'));
    console.info(d.add(Date.MONTH, -1).format('n'));
    console.info(d.add(Date.MONTH, -2).format('n'));

film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar