Javascript set date function sequence issue

This is a javascript date error that occurs in FireFox, Chrome and IE.
In setting the date using utc functions the order in which the functions are used can cause the wrong date set be set.
var d = new Date();
d.setUTCFullYear(2012,1,26);
correctly sets the date:
Sun Feb 26 2012 10:10:33 GMT-0500 (Eastern Standard Time)
var d = new Date();
d.setUTCFullYear( 2012 );
d.setUTCMonth( 1 );
d.setUTCDate( 26 );
incorrectly sets the date:
Mon Mar 26 2012 11:10:33 GMT-0400 (Eastern Daylight Time)
var d = new Date();
d.setUTCDate( 26 );
d.setUTCMonth( 1 );
d.setUTCFullYear( 2012 );
correctly sets the date:
Sun Feb 26 2012 10:10:33 GMT-0500 (Eastern Standard Time)
It appears the full date isn't being used to re-validate/calc the date upon setting single utc parms.
Thanks.
This happens Windows 7, NOOK...

Short answer; no, doesn't happen Apr 1.
<br/>Longer answer; I set up a page to loop through everyday of a given month.
<br/>(http://itriware.com/lab/test/datetest.html)
<br/>Changing the machine date results in:
* md:30-Mar - no good for the month of Feb.
* md:31-Mar - no good for the months: Feb, Apr, Jun, Sep, Nov.
* md:01-Apr - ok
* md:30-Apr - no good for the month of Feb.
* md:31-May - no good for the months: Feb, Apr, Jun, Sep, Nov.
(md=machine date)
Seems to be an end of the month issue, depending on the sequence of setting the utc parms, the month rolls over but isn't adjusted back when setting the next parm...sometimes.
After thinking about it;
Seems that if the machine day of month is greater than the # of days in the requested month it fails, hence feb always fails and only requested months with 30 days fail when the machine date is the 31st. In the sequence setUTCFullYear, setUTCMonth, setUTCDate.

Similar Messages

  • Set data function

    hi folks,
    i'm new to flex and that is why i don't know when the set data function of item renderer is called. means what causes the call for set data function of item renderer?
    i inherited a flex application (the developer left) and i am wondering why the set data function of one item renderer is called when an item of the item renderer was clicked but the set data function of another item renderer is called just one time (when the view is created) but never again even if an item of the item renderer was clicked.
    so please can someone explain me or mention a good ressource for reading about how it works?

    Whenever data changes in some way, for example when the dataprovider is changed, the set data function is called automatically.
    Some tips:
    1. Make sure the dataprovider is bound (<s:List dataprovider="{myDataCollection}"/>
    2. If you change the dataprovider, call the refresh() function (like when the dataprovider is a IListCollectionView)
    3. override the set data function in your itemRenderer to do additional things there.
    Hope this helps
    Dany

  • Problem overloading "set data" function on Button DataGrid Renderer

    Hi all, I'm hoping this is something simple.
    I have a class that extends mx.controls.Button and implements mx.core.IDataRenderer.  I need to set the button icon whenever the Data property is set from the DataGrid.  My problem is that my overloaded set/get Data function are never called (I've stepped through the code in debug).  Instead the set/get functions in Container.as (Flex 3.4 SDK) get called.
    Here's the basics code:
    exportButtonRenderer.as
    package controls
        import flash.events.Event;
        import flash.events.MouseEvent;
        import mx.controls.Button;   
        import mx.core.IDataRenderer;
        import mx.controls.dataGridClasses.DataGridListData;   
        import mx.controls.listClasses.BaseListData;
        import mx.events.FlexEvent;
        import mx.controls.Alert;
        import model.descriptors.compDescriptor;
        import events.exportClickedEvent;   
        public class exportButtonRenderer extends Button implements IDataRenderer   
            //    embed your icons
            [Embed(source='/assets/icons/export.png')]
            [Bindable]
            public static var imageExport:Class;
            [Embed(source='/assets/icons/blank.png')]
            [Bindable]
            public static var imageBlank:Class;
            public function exportButtonRenderer()
                super();
            private var _listData:DataGridListData;
            override public function get listData():BaseListData
                return _listData;
            override public function set listData(value:BaseListData):void
                _listData = DataGridListData(value);
            private var _data:Object;       
            override public function get data():Object
                return _data;
            override public function set data(value:Object):void
                _data = value;
            override protected function clickHandler(event:MouseEvent):void
                super.clickHandler(event);   
    Now I know I'm using the Flexlib TreeGrid and not a standard DataGrid but when I trace through all the code all code firing the set/get functions is coming from the DataGrid anyway.
    Here's the my Grid def in my main app mxml:
    Header 1
    <flexlib:TreeGrid
            id="MKTXGrid"
            dragEnabled="false" sortableColumns="false" showRoot="false"
            disclosureClosedIcon="@Embed(source='/assets/icons/arrow_right.png')"
            disclosureOpenIcon="@Embed(source='/assets/icons/arrow_down.png')"
            folderOpenIcon="@Embed(source='/assets/icons/psd.png')"
            folderClosedIcon="@Embed(source='/assets/icons/psd.png')"       
            click="MKTXGrid_clickHandler(event)"
             doubleClickEnabled="true" doubleClick="MKTXGrid_doubleClickHandler(event)" left="0" right="0" top="0" bottom="16">
        <flexlib:columns>
                <flexlib:TreeGridColumn dataField="Name" headerText = "Name" minWidth="200" width="200" editable="true"/>
                <mx:DataGridColumn dataField="ExportName" headerText = "Export Name"/>
                <mx:DataGridColumn dataField="Export" headerText = "Export" width="50" minWidth="20" resizable="false">
                 <mx:itemRenderer>
                    <mx:Component>
                        <mx:Box horizontalAlign="center" width="100%" verticalScrollPolicy="off" horizontalScrollPolicy="off">
                            <controls:exportButtonRenderer label="Export" icon="@Embed(source='assets/icons/export.png')" width="12" height="12" useHandCursor="true">                        
                                <controls:click>
                                    <![CDATA[
                                        import events.exportClickedEvent;
                                        var e:exportClickedEvent = new exportClickedEvent();
                                        e.itemData = data;
                                        dispatchEvent(e);
                                    ]]>
                                </controls:click>
                            </controls:exportButtonRenderer>
                        </mx:Box>
                    </mx:Component>
                </mx:itemRenderer>
                </mx:DataGridColumn>
            </flexlib:columns>
        </flexlib:TreeGrid>
    Nothing too special going on.
    I know this can be done, I've seen examples in the SDK:
    http://opensource.adobe.com/svn/opensource/durango/trunk/ExternalFlexTools/com/dougmccune/ containers/accordionClasses/AccordionHeader.as
    By the way I've stepped through the code of the TreeGridItemRenderer class in Flexlib which works correctly and the class def starts like this:
    TreeGridItemRenderer.as
    import flash.display.DisplayObject;
    import flash.display.InteractiveObject;
    import flash.display.Shape;
    import flash.display.Sprite;
    import flash.events.Event;
    import flash.events.MouseEvent;
    import flash.geom.Point;
    import flash.geom.Rectangle;
    import flexlib.controls.TreeGrid;
    import mx.controls.Image;
    import mx.controls.dataGridClasses.DataGridListData;
    import mx.controls.listClasses.BaseListData;
    import mx.controls.listClasses.IDropInListItemRenderer;
    import mx.controls.listClasses.IListItemRenderer;
    import mx.core.IDataRenderer;
    import mx.core.IFlexDisplayObject;
    import mx.core.IToolTip;
    import mx.core.SpriteAsset;
    import mx.core.UIComponent;
    import mx.core.UITextField;
    import mx.events.FlexEvent;
    import mx.events.ToolTipEvent;
    import mx.events.TreeEvent;
    import mx.managers.ILayoutManagerClient;
    import mx.styles.IStyleClient;
    public class TreeGridItemRenderer extends UIComponent
                                      implements IDataRenderer,
                                                   IDropInListItemRenderer,
                                                 ILayoutManagerClient,
                                                   IListItemRenderer
    Any help would be great!

    That's because you put your component in a Box.  The DataGrid is setting the Box's .data property and no code is setting the one on your component.  You shouldn't really need Box.  You can override updateDisplayList to center your Button instead.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • How to make sure override public function set data(item:Object) is called on vertical scroll

    Hi
    I am facing an issue with my datagrid with renderers on all its columns.I need to enable or disable the render components based on values in different columns in the row.Its works fine in most of the places .But in some places which is not visible without the scroll,it seems the set data function is not called,because of which the component will be enabled when it has to be disabled.How do i ensure it works fine all the time.
    Regards
    Sidd

    The set data is probably being called.   Keep in mind that renderers are recycled so the enabled/disabled state must be fully derived from the row's data.
    Alex Harui
    Flex SDK Developer
    Adobe Systems Inc.
    Blog: http://blogs.adobe.com/aharui

  • Flex override public function set data

    Hi,
    I have a datagrid with itemRenderer in datagridcolumn as my custom component(c1). I am getting the dataprovider data in custom component by overriding the set data function, it is fine. But now my custom component(c1) is also having another custom component(c2).
    Now the doubt is - how to get the dataprovider data in c2 component?
    Thanks in advance.

    Create a property with name custom_data in component c2
    set the value of  _customData in c2 object created in c1 with the data u get in c1 in commitProperties method of c1.
    c2.customData = this.data;

  • Set Data

    Hi
    1. I am trying to use the SET data functionality from the System- Userprofile.
    The data is getting"SET" but next time if i execute the same transaction then i dont see the set value.
    example: 1. In Tcode VA01 for me the plan and the sales area doesnt change so i am planning to use the SET data.
                   2. The data gets set only temporarily but next time when iput va01 again asking me for reentering.
    kindly let mek now your valuable inputs to solve this..
    reg
    satheesh

    Sorry.  The link given to me by another in this forum:
    http://support.apple.com/manuals/#appleremotedesktop
    first link is v2.2.  I thought the most recent would show up at the top...
    I should have looked at the bottom 

  • Javascript Date() function not working

    Hi,
    I'm experiencing some problems with the Date() function in javascript. The problem is that the function doesn't seem to work. For example when I do "var date = new Date(); xfa.host.messageBox(date);" in the enter event of a date field, I get "Date is not a function" error message in de javascript debugger.
    Is there anyone out there who knows how why the Date function is not working in LiveCycle Designer. Am I using the Date function in an improper way or maybe I am using the wrong function?
    Please can anyone help me out?

    Hi Paul,
    Thanx for you reply. It worked fine.
    I also found out that following works as well:
    var MyDate = util.scand("dd-mm-yyyy",new Date());
    console.println("this date: "+util.printd("dd-mm-yyyy", MyDate));

  • Simple Javascript date() function not executing.

    If I open the javascript input window from a button and enter a simple js date function:
    vDate = new Date();
    alert(vDate();
    This code executes flawlessly when the button is clicked.
    However,  if I place the exact same code in the Execute Advacned Actions javascript window "on enter frame" Action, the alert popup code not exdecute/appear, it will fail silently.
    I'm simple trying to get a javascript funtion to execute on... the On Enter Action.
    Any suggestions?
    Thanks

    Hello,
    I just tried the scenario and I can see that JS code is executing properly. I used the same JS as you have given (just corrected the syntax in the second line). So, I create an Advanced action that has this JS, and I assigned that to "On Slide Enter" action of the slide. Other thing that I did is that I chose "current" as the window in the Execute Javascript options.
    Ashish

  • Loss style when overriding the function 'set data' for a TileList

    Hi!
    In a TileList, I set the itemRenderer for a components from
    where I override the function set data like in this example:
    but, by doing this, I'm loosing all the built-in CSS
    behavior. The onMouseOver effect the change the backgroundColor and
    the hand pointer. I try to set it programmatically but without
    success.
    An idea?
    Thank you

    "FlexBin" <[email protected]> wrote in
    message
    news:gdaj4r$noj$[email protected]..
    > Hi!
    >
    > In a TileList, I set the itemRenderer for a components
    from where I
    > override
    > the function set data like in this example:
    >
    > but, by doing this, I'm loosing all the built-in CSS
    behavior. The
    > onMouseOver
    > effect the change the backgroundColor and the hand
    pointer. I try to set
    > it
    > programmatically but without success.
    >
    > An idea?
    >
    > Thank you
    >
    > public override function set data(value:Object):void
    > {
    > var xml:XML = new XML(value);
    >
    > if(this.backgroundIconName != null &&
    > this.ico != null &&
    > this.labelText != null) {
    >
    > if(xml.backgroundIconName != "") {
    >
    > this.backgroundIconName.source = "assets/" +
    xml.backgroundIconName;
    > }
    >
    > this.backgroundIconName.visible =
    (xml.backgroundIconName != "");
    >
    > this.ico.source = "assets/" + xml.iconName;
    > this.ico.width = Number(xml.width);
    > this.ico.height = Number(xml.height);
    >
    > this.labelText.text =
    resourceManager.getString('myResources',
    > xml.label);
    > }
    >
    > if(xml.@available == 'false')
    > {
    > this.enabled = false;
    > }
    > }
    There are examples of how to properly implement this kind of
    functionality
    in the itemRenderers here:
    http://flexdiary.blogspot.com/2008/09/groupingcollection-example-featuring.html
    http://flexdiary.blogspot.com/2008/09/extended-datagrid-with-stylefunction.html

  • Hi, My ipad has been stolen and I set up the erase data function in i cloud "find my device". I then changed my mind and wanted to change this to locate my device

    Hi, My ipad has been stolen and I set up the erase data function in i cloud "find my device". I then changed my mind and wanted to change this to locate my device rather. When I deleted the "erase" option it removed my ipad from the find my device list. Can I restore it back onto the list?

    Once a wipe is sent, it cannot be stopped. You will not be able to track your iPad after that.

  • Date function issue

    Hi Experts,
    I have an requirement related to date function in WebI.
    I am working on BO 4.2 version.From the source system,I am getting the data for start date and end date.And now I need to maintain additional two more columns i.e one column is MONTHS and other column is DAYS.
    Lets Say :
    Start Date : 01 January,2014 = 01-01-2014
    End Date : 05 April,2014 = 05-04-2014
    For the above example , In the report output , it should display as :
      START DATE       END DATE             MONTHS    DAYS
      01-01-2014            05-04-2014                 3                4
    Could anyone please let me know , which date function do I need to use in the formula, to achieve the above requirement?
    Appreciate for your quick response.Thanks in advance

    v_dayDifference=DaysBetween([Start Date];[End Date])
    v_Month=Floor([v_dayDifference]/30)
    v_Days=([v_dayDifference]-[v_Month]*30)
    This will give you the output like below:
    Start Date 
    End Date 
    v_Month 
    v_Days 
    01 Feb, 2014 
    02 Mar, 2014 

    29 
    01 Jan, 2014 
    01 Jan, 2014 


    01 Jan, 2014 
    05 Apr, 2014 


    01 Jan, 2014 
    31 Jan, 2014 


    05 Jan, 2014 
    01 Apr, 2014 

    26 
    31 Jan, 2014 
    01 Feb, 2014 

  • Function sequence error

    Hi Chris, we where using this Java code with TimesTen 5.1.34:
    while (rs.next()) {
    associatedMsbs.add(Integer.toString(rs.getInt(HGROUPID)));
    // Prepare object to insert in database
    SvcLog_VO svcLog = new SvcLog_VO();
    svcLog.setLogId(svcLogDAO.getlogIdNextVal(conn));
    svcLog.setService( CommonConstants.MobileSwitchboardSvcId );
    svcLog.setOperType( CommonConstants.OPER_TYPE_UPDREL );
    svcLog.setEntityType( CommonConstants.ENTITY_TYPE_MOBILESWITCHBOARD);
    svcLog.setEntityId( rs.getInt(HGROUPID) );
    svcLog.setRelEntityId( woUserId );
    // Insert object in database
    svcLogDAO.insertData(svcLog, conn);
    This code no longer works in TimesTen 7.0.3. We receive the following error:
    [TimesTen 7.0.3.0.0 ODBC Driver]Function sequence error.
    We had to change the code this way:
    while (rs.next()) {
    // Prepare object to insert in database
    SvcLog_VO svcLog = new SvcLog_VO();
    svcLog.setLogId(svcLogDAO.getlogIdNextVal(conn));
    svcLog.setService( CommonConstants.MobileSwitchboardSvcId );
    svcLog.setOperType( CommonConstants.OPER_TYPE_UPDREL );
    svcLog.setEntityType( CommonConstants.ENTITY_TYPE_MOBILESWITCHBOARD);
    svcLog.setEntityId( rs.getInt(HGROUPID) );
    svcLog.setRelEntityId( woUserId );
    // Store object in ArrayList
    svcLogs.add(svcLog);
    // Insert the objects in the ArrayList in database
    for (int i = 0; i < svcLogs.size(); i++) {
    SvcLog_VO svcLog = (SvcLog_VO)svcLogs.get(i);
    svcLogDAO.insertData(svcLog, conn);
    Once we split the code in two, first iterating the ResultSet and then inserting the objects, it works properly again. Is there any known issue in TimesTen about this?
    Thanks in advance,

    Hi, Chris:
    The code where this occurs is the following:
    public void insertParameters(String xxx1, String xxx2, String xxx3,
    int xxx4, Connection conn) throws TTException, SQLException {
    PreparedStatement ps = null;
    String query = null;
    try {
    query = queryInsert;
    ps = conn.prepareStatement(query);
    ps.setInt(1, xxx1);
    ps.setString(2, xxx2);
    ps.setString(3, xxx3);
    ps.setString(4, xxx4);
    // If debug is activated, the query is printed
    if (log.isDebugEnabled()) {
    ReadableQuery rq = new ReadableQuery();
    rq.addParam(new Integer(xxx1));
    rq.addParam(new String(xxx2));
    rq.addParam(new String(xxx3));
    rq.addParam(new String(xxx4));
    log.debug(" Query to execute .. [" + rq.get(query) + "]");
    ps.executeUpdate();
    // Exception handling
    catch (Exception ex) {
    log.error(ex);
    throw new TTException(ex);
    } // Resources are closed
    finally {
    try {
    if (ps != null) {
    ps.close();
    } catch (SQLException e) {
    log.error("Error closing JDBC resources");
    throw e;
    This method accesses to DDBB and inserts data in a table with the following structure
    Command> desc wo.bs_tb_bsvc_param_values;
    Table XXXXXXX:
    Columns:
    *aaa                          TT_INTEGER NOT NULL
    *bbb                       TT_CHAR (35) NOT NULL
    ccc TT_CHAR (10) NOT NULL
    ddd TT_CHAR (256) NOT NULL
    1 table found.
    (primary key columns are indicated with *)
    Command>
    Thanks.

  • Use a Parameter or Formula in the Date() function

    I am trying to filter a result set utilizing the Date() function.  I am trying to get all of the data between June 1st of a given year, and a parameterized date.  Here is the formula
    {ReportStatic.rpsActualSaleDate} >= Date({@fPrevioustoLastYear}, 7, 1)
    and {ReportStatic.rpsActualSaleDate} < DateAdd("yyyy", -2, {?pDateEnd})
    and {ReportStatic.rpsSaleStatus} = 1
    The value of fPrevioustoLastYear is '2008'
    The report is returning 0 records.  I think it is because the Date() function isn't recognizing the formula (fPrevioustoLastYear) as a valid input.  However when I "Save and close" the formula editor doesn't find any problems with the formula.
    What should I be doing differently?

    If {@fPreviousToLastYear} is in fact 2008, I don't see an issue (with the possible exception that it should be a number, not a string; convert with CInt()).  Please post your formula for that field.
    Also, I have to ask what the value of {?pDateEnd} is.  If it's like today, no records will fit the criteria because you'd be checking if the date was between 7/1/2008 and 3/29/2008 (you're subtracting 2 years from the parameter), which is a null set.
    HTH,
    Carl

  • IS_Data Insight View Data Function Limitation

    Hi Experts,
    Is there any limitation to view data of a table using View Data function in Data Insight module in Information Steward. I come across a strange issue with this, the details are explained below.
    I am trying to perform Data profiling on table, as part of this I imported table into a Data Insight project. When i tried to view data of a table using View Data function, it is showing blank like (0 from 998987). I am able able to see data in database and even in DS designer too.
    Then i created a view on top of this table by selecting all columns and tried to view data, again showed blank. Then i removed some columns in view and tried, now it showed data. The table contains 150 columns, I used around 110 columns in view.
    My question here is, is there any limitations in Data Insight for viewing data apart 500 records. Will View Data function consider the number of Rows or the size of data to display the data. If it consider these two, is there any option available in IS to control these two parameters i.e., increase / decrease the size or no of rows.
    If anyone come across with this issue, could you please help me if any solutions to fix this.
    Thanks,
    Ramakrishna Kamurthy

    Hello Rama,
    In IS 4.2 this limitation is actually stated.
    See here: IS_421_user_en.pdf in Related Information section pg 44 which states that:
    The software displays only 500 records when you view data from an SAP table. 
    Also more details available in section: 2.5.10.2 Limit of 500 records when viewing data from SAP tables.
    The software displays only 500 records when you view data from an SAP table.
    Views that contain SAP tables have the potential to be quite large, especially when they are joined with other SAP tables. The limit of 500 records when viewing data prevents your computer from hanging or never completing the task because the tables were too large.
    In addition to the 500 records limit, you can take steps to enhance performance in the following ways:
    ● Reduce the size of the file by mapping fields, join conditions, filters, and so on to limit the data in the table to information that you really need.
    ● Use SAP ABAP-supported functions in forming expressions in views. Using non-supported functions is allowed, but doing so may adversely affect performance.
    ● Use the View Data filter tools when you view and export data from SAP tables.
    With the 500 records limit for viewing SAP table data, there is a potential for no records showing up in the View Data window.
    This could happen, for example, when the view contains a child view, the child view contains one or more SAP tables, and a join is set up to join the entire data set.
    A message appears at the top of the View Data window that instructs you to export the data to an external source (text file, CSV, or Excel file) to view all of the records.
    I hope this is helpful.
    Mike

  • Queries with date functions using PreparedStatement for multiple DB

    I am developing application that uses DB independant queries. I am using preparedstatement to process the queries. I need to use date functions for query selection criteria.
    for eg.
    selecting the list of employees who had joined in the last 15 days
    selecting list of employees who had joined between two dates etc.
    where Date Joined field is a Timestamp value. To extract date no DB specific function can be used.
    If I use setMonth, setYear etc.. to set params in the pstmt the query becomes complex in the above case. Can any one throw some light on how to do the above in preparedstatement or any other better alternative.
    Tx a lot

    Hi,
    I did not mean that way. I presume that there is a timestamp value (may be a date too) column in the table. Then based upon your requirement (say before 15 days) pass the value as date (or time stamp) in the query as a parameter.
    String qry = "select * from myTable where join_date <= ?";
    stmt.setDate(1,myDate); // this is where you will have to manipulate the value to suit your DB timestamp or date value; you will have compatibility issues with util.Date and sql.Date so use Calendar class to satisfy.Feel free to mail me if you need further clarifications to [email protected]
    Cheers,
    Sekar

Maybe you are looking for

  • RSBOLAP 018 Error In WAD

    Hi Experts, i am using BI 7.0. And am trying to execute reports from WAD. However it always gives an error saying "RSBOLAP 018 Java System Error: An unknown error has occoured during portal communication" while opening the report and "RSBOLAP 018 Jav

  • Problem with packages

    hi.. i have made about 3 java files in the folder "pack1" n put those files in the package by writing package pack1 as the first line in those files. When i use those classes in a fourth file which is also in the same folder, it somtimes sayz "class

  • Photo's not syncing

    Hi all, Hoping someone can help me as I can't see what I am doing wrong here. New iPad arrive this morning (woo hoo), however the photo's are just not syncing properly and never had any issues with the iPad 1. My photos are stored on an external hard

  • Why can't I delete music from my iphone under IOS6 while using iTunes Match?

    It's easy enough to add music from the Cloud, but I have a HUGE music collection (all legally acquired, thanks) and I don't always want the same music taking up space on my iPhone. How do I get rid of a song/album/playlist, without turning off iTunes

  • Can I restore lost photos from my camera?

    I was transferring pictures from my camera to my computer.  I had selected them and was going to drag them to a file on computer but hit delete instead.  Is there a way to recover them?