Results 1 to 5 of 5

Thread: Subtract a lot of seconds from any date

  1. #1
    Sencha User
    Join Date
    Feb 2012
    Posts
    255
    Answers
    6
    Vote Rating
    2
      0  

    Default Answered: Subtract a lot of seconds from any date

    From the Ext help I have thus far
    Code:
    var dt1 = Ext.Date.add(new Date(1989,11,17,3,24,0);, Ext.Date.DATE, -5);
    but a guess is Ext.Date.DATE in the help is given Ext.Date.Day ,-5 to subtract 5 days. How can I use this method to convert strings ?

    thanks

  2. Like this?

    Code:
    var seconds = 5 * 24 * 60 * 60 * -1; //5 days worth of seconds
    
    var date = Ext.Date.add(new Date(1989,11,17,3,24,0), Ext.Date.SECOND, seconds);

  3. #2
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    What do you mean convert strings?
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  4. #3
    Sencha User
    Join Date
    Feb 2012
    Posts
    255
    Answers
    6
    Vote Rating
    2
      0  

    Default

    Sorry I meant how can I convert a lot of seconds from this date. I have a chunk of seconds , here it tells me how to subtract 5 days. That doesn't help with my problem. How can I subtract seconds and be sure not to have a problem with leap years etc..

  5. #4
    Sencha - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,551
    Answers
    3931
    Vote Rating
    1271
      0  

    Default

    Like this?

    Code:
    var seconds = 5 * 24 * 60 * 60 * -1; //5 days worth of seconds
    
    var date = Ext.Date.add(new Date(1989,11,17,3,24,0), Ext.Date.SECOND, seconds);
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    https://github.com/mitchellsimoens

  6. #5
    Sencha User
    Join Date
    Feb 2012
    Posts
    255
    Answers
    6
    Vote Rating
    2
      0  

    Default

    Once again you are right monsieur - thanks.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •