DatePicker loosing a day. - InfoPath Dev

InfoPath Dev

Use our Google Custom Search for best site search results.

DatePicker loosing a day.

Last post 11-01-2004 06:44 AM by sakieboy. 6 replies.
Page 1 of 1 (7 items)
Sort Posts: Previous Next
  • 10-22-2004 08:22 AM

    DatePicker loosing a day.

    I've noticed that my Webservice is returning a date ie. 2004-10-04T00:00:00.0000000-04:00 but my DatePicker in InfoPath is Displaying 10/3/2004. Is there a quick workaround for this?
  • 10-22-2004 11:48 AM In reply to

    Re: DatePicker loosing a day.

    The dateTime you are receiving back has a shift for time zone:

    If you want the current dateTime, not accounting for a time zone, you need to grab the first 19 characters:

    Perhaps the Web service can be configured to return a dateTime without the time zone. If not you can use code to fix this.

    Greg Collins [InfoPath MVP]
  • 10-25-2004 01:52 PM In reply to

    Re: DatePicker loosing a day.

    I can't seem to find any easy way to substring the code in the Web Service because the contents are within a dataset and it looks like this:
    <xs:element name="MyDate" type="xs:date" minOccurs="0" />
    It doesn't give me an option to do a substring. So I'm not sure if my Web Service is able to handle it, if so, I'm not sure of where or how. You mentioned code that can be done to create this date. I take it you're talking about within the JS file in InfoPath. Would you happen to have this code and where would I place it within the JS file?

    Also, if a DropDownList displays a "0", to which it received from a Web Service, although the database shows it as NULL. I'm wondering is there anyway that we can make this value "Empty" or "Please select item"?
  • 10-25-2004 01:59 PM In reply to

    Re: DatePicker loosing a day.

    Hmmm. Your not even working with a dateTime type, yours is defined strictly as a date type.

    For JScript you would just use sDate.substring(0, 10); This would give you "2004-10-04".

    What I don't understand is why you are getting all the time and time zone information for a date type.

    Greg Collins [InfoPath MVP]
  • 10-25-2004 02:28 PM In reply to

    Re: DatePicker loosing a day.

    My type for the date in SQL is a smalldatetime.

    Also, the second issue I resolved by changing my int types in SQL to nvarchars.

    I'll try the sDate.substring in the form_load...

    SOLUTION: In SQL I added 5 hours to the date DATEADD(hh,5,MyDate).

    2 other issues and my first form will be complete.

    1) I currently have 2 datepickers, one to display the date and the other to display the time. I'm not sure if I should do this or display them both in the same datepicker. Anyway, when I attempt to change the time, I get a submit error "Error converting data type datetime to smalldatetime."

    2) I have fields in my database that are required, WhoAdded, WhoLastChanged, DateAdded, and DateLastChanged. Of course, I would like NOT to have these fields visible on my form, and would rather have the values interpreted, ie, the WhoLastChanged and WhoAdded I would like to come from the NT Logon Name, and the DateLastChanged and DateAdded would be the Current System datetime of the submit. Suggestions? This is only an issue if I am attempting to INSERT the form information into the database.
  • 10-26-2004 06:12 PM In reply to

    Re: DatePicker loosing a day.

    I'm glad you got that fixed. Its sounds like kind of a hack of a solution, but it seems to work for now.

    1) Date picker's don't actually pick time - only dates. To pick times, you should have a textbox or a drop-down list. Binding both a date picker and a time text box to the same field is not a good idea. The values will override each other. You can have 2 fields (one date, and one time) that use the concat() function to merge them into a single dateTime field.

    Also, what exatly is the format of smalldatetime compared to datTime? dateTime format is yyyy-mm-ddThh:mm:ss. If this doesn't match the format of smalldatetime, that might be where the problem is coming from.

    2) Fields don't need to be visible in the form to be filled in. Just don't have them in the form and use code to populate their values. There have been numerous discussions on the public newsgroup about how to get system login info if you need that help. Search Google Groups.

    Greg Collins [InfoPath MVP]
  • 11-01-2004 06:44 AM In reply to

    Re: DatePicker loosing a day.

    Is there a simple way of handling military time? Currently, that's what my DatePicker control is expecting. I wrote a function to handle this and it appears to work ok. Once I select a record from the database via a dropdownlist, the values are populate, immediately after they are populated I would like a few of the fields to be repopulated to keep track of the UserName and the TimeDateStamp.

    I have code to do this, but the code will not execute, it appears to bomb out on the

    IXMLDOMNode nodeWhoLastChanged = thisXDocument.DOM.selectSingleNode("/dfs:myFields/dfs:dataFields/s0:SelectEmploymentOfferRequestByResumeIDResponse/s0:SelectEmploymentOfferRequestByResumeIDResult/ns1:DataSet1/ns1:dbo_udp_SelectEmploymentOfferRequestByResumeID/ns1:WhoLastChanged");

    SOLUTION: Get out of Visual Studio and reload it.
Page 1 of 1 (7 items)
Copyright © 2003-2019 Qdabra Software. All rights reserved.
View our Terms of Use.