<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Newbie Questions</title><link>https://www.infopathdev.com:443/forums/39.aspx</link><description>New to InfoPath? Search to see if your question has already been answered. If it has not, then ask it here or the appropriate topic forum.</description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: Help with datetime validation</title><link>https://www.infopathdev.com:443/forums/thread/122593.aspx</link><pubDate>Fri, 20 Mar 2020 15:13:33 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:122593</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/122593.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=122593</wfw:commentRss><description>Yup, you are right - I mistyped those! So the easy way to find out how InfoPath stores data is to add a date time control to a form, fill it out, and open the saved XML with a text editor. I&amp;#39;ll see if I can help w/ your other question.</description></item><item><title>Re: Help with datetime validation</title><link>https://www.infopathdev.com:443/forums/thread/122591.aspx</link><pubDate>Fri, 20 Mar 2020 04:34:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:122591</guid><dc:creator>firestratt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/122591.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=122591</wfw:commentRss><description>I have 1 more question - if you would be able to help me out. I&amp;#39;m not finding much luck online and I am running out of options on how to make this work. I created another post about publishing to a network drive. I&amp;#39;m not sure how you search the forum for my question as I am very new to the website but my post is called &amp;quot;Publishing and Infopath form to network location&amp;quot; - again I&amp;#39;m not sure what to do :(</description></item><item><title>Re: Help with datetime validation</title><link>https://www.infopathdev.com:443/forums/thread/122586.aspx</link><pubDate>Thu, 19 Mar 2020 17:18:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:122586</guid><dc:creator>firestratt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/122586.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=122586</wfw:commentRss><description>My apologies, I had mistyped the last two formats I had tried which were: format(DateTimeField, &amp;#39;yyyy-dd-MMTHH:mm:ss&amp;#39;), format(DateTimeField, &amp;#39;yyyy-dd-MMTHH:mm:ss&amp;#39;). In your previous response you had the date as yyyy-dd-MM but you just suggested &amp;#39;yyyy-MM-dd&amp;#39; so I did swap the month and day and that did work. So thank you for your help its returning without the red lines now! Much appreciated!</description></item><item><title>Re: Help with datetime validation</title><link>https://www.infopathdev.com:443/forums/thread/122585.aspx</link><pubDate>Thu, 19 Mar 2020 16:55:19 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:122585</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/122585.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=122585</wfw:commentRss><description>&lt;p&gt;I don&amp;#39;t understand why you formatted your date time to use a slash when you need to use the dash, as per all my earlier posts. Or why you are using a different format than what I suggested. As I&amp;#39;ve said, you need to format in a date time format that XML uses, which is &lt;strong&gt;yyyy-MM-ddTHH:mm:ss&lt;/strong&gt; &lt;/p&gt;&lt;p&gt; Edited to add a sample date time - using today&amp;#39;s date: &lt;strong&gt;2020-03-19T10:02:05&lt;/strong&gt;&lt;/p&gt;</description></item><item><title>Re: Help with datetime validation</title><link>https://www.infopathdev.com:443/forums/thread/122584.aspx</link><pubDate>Thu, 19 Mar 2020 16:49:38 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:122584</guid><dc:creator>firestratt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/122584.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=122584</wfw:commentRss><description>Thank you. So I have edited my SQL statement to read like so: format(DateTimeField, &amp;#39;MM/dd/yyyy HH:mm:ss&amp;#39;), format(DateTimeField, &amp;#39;MM/dd/yyyyTHH:mm:ss&amp;#39;), 
 format(DateTimeField, &amp;#39;yyyy/dd/MM HH:mm:ss&amp;#39;), format(DateTimeField, &amp;#39;yyyy/dd/MMTHH:mm:ss&amp;#39;). These all when returned show as I specify but still have the red dotted lines. I don&amp;#39;t understand what I&amp;#39;m doing wrong. If I said the function on the field to now() it displays the date in the text field as &amp;#39;MM/dd/yyyy HH:mm:ss&amp;#39;. Should I be doing something to the datetime field within my c# code before pushing it back to the form??</description></item><item><title>Re: Help with datetime validation</title><link>https://www.infopathdev.com:443/forums/thread/122563.aspx</link><pubDate>Mon, 16 Mar 2020 22:41:23 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:122563</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/122563.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=122563</wfw:commentRss><description>You need HH. So, just adding the &amp;quot;T&amp;quot; is not enough, you need a 0 before the hour. Return it from SQL like (replace getdate function with your column): SELECT FORMAT (getdate(), &amp;#39;yyyy-dd-MMTHH:mm:ss&amp;#39;)</description></item><item><title>Re: Help with datetime validation</title><link>https://www.infopathdev.com:443/forums/thread/122562.aspx</link><pubDate>Mon, 16 Mar 2020 22:32:10 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:122562</guid><dc:creator>firestratt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/122562.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=122562</wfw:commentRss><description>Hilary - Thank you for getting back to me. So in my stored procedure I am now returning the smalldatetime which is currently set in the DB as &amp;#39;2020-03-13 08:42:00&amp;#39; and so I am now returning the date as an nvarchar -&amp;gt; &amp;#39;03-13-2020 8:42:00 AM&amp;#39;  but when it returns the date to the Date Time field on the form it does show the datetime as &amp;#39;03-13-2020 8:42:00 AM&amp;#39; but still has the red dotted lines. The date is being returned to a text box and I&amp;#39;ve checked the formatting on the field I have selected &amp;quot;None (display XML value)&amp;quot; and I have also selected &amp;quot;Display the date like this: *3/14/2001&amp;quot; with the time as &amp;quot;*9:46:55 AM&amp;quot;. The data type on the field under the data tab is &amp;quot;optional_dateTime.notz&amp;quot;. I have also tried returning the date from SQL as &amp;#39;03-13-2020T8:42:00 AM&amp;#39; with still the same result. I am not sure what to do at this point?</description></item><item><title>Re: Help with datetime validation</title><link>https://www.infopathdev.com:443/forums/thread/122514.aspx</link><pubDate>Tue, 10 Mar 2020 14:32:25 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:122514</guid><dc:creator>Hilary Stoupa</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/122514.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=122514</wfw:commentRss><description>&lt;p&gt;&amp;nbsp;XML date times look like this: 2020-03-09T12:31:22 &lt;/p&gt;&lt;p&gt;When you set the field, you may just need to replace the space in your SQL date with a T.&amp;nbsp;&lt;/p&gt;</description></item><item><title>Help with datetime validation</title><link>https://www.infopathdev.com:443/forums/thread/122507.aspx</link><pubDate>Sun, 08 Mar 2020 21:55:13 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:122507</guid><dc:creator>firestratt</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/122507.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=39&amp;PostID=122507</wfw:commentRss><description>I&amp;#39;m not sure if this is where to start but I&amp;#39;m having an issue with displaying a datetime in an infopath 2013 form. Little background: this is an infopath 2013 form that is saved to a network location for users to enter data. My main connection is a connection to SQL 2017. I have a smalldatetime column on the SQL table called referralDateTime (smalldatetime; &amp;quot;2020-01-03 07:45:00&amp;quot;. On my infopath form I have a text box/ready only that the returned date populates.

On the form a user enters a date range on the form, I pass those values using c#, then call a stored procedure which returns data based on the parameters I&amp;#39;m passing. This all works perfectly. However, when the referralDateTime is displayed on the infopath form, it displays the value as &amp;quot;3/1/2020 07:45:00 AM&amp;quot; but has the dotted red lines around the box. I have tried formatting the date with SQL to match that format in infopath, but still red lines. I am unsure how to format this to avoid the red lines on the text box. Here is the c# code that I&amp;#39;m using currently that does return the datetime value to the user screen:

            // Reading in values from Stored Proc
            SqlDataReader dataReader;
            SqlDataAdapter da = new SqlDataAdapter(_oCommand);
            DataSet ds = new DataSet();
            da.Fill(ds, &amp;quot;RetrieveData_View&amp;quot;);
            dataReader = _oCommand.ExecuteReader();

            // Create a navigator for the xpath doc or set of 
            XPathNavigator nav = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:TestReferrals&amp;quot;, NamespaceManager);
            XPathNavigator RetrieveData_View = nav.Clone();

            MessageBox.Show(&amp;quot;Please wait while data is retrieved...&amp;quot;, &amp;quot;Referral Submission&amp;quot;, MessageBoxButtons.OK, MessageBoxIcon.Information);

            // This will read / loop through data being returned from Stored Procedure
            while (dataReader.Read())
            {

                Global.dateTimeOfReferral = dataReader[&amp;quot;DateTimeofReferral&amp;quot;].ToString();
                RetrieveData_View.SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:TestReferrals/@DateTimeofReferral&amp;quot;, NamespaceManager).SetValue(Global.dateTimeOfReferral);
                
                RetrieveData_View.InsertAfter(RetrieveData_View);
            } // END OF WHILE LOOP

            // Deleting duplicate row retrieved
            XPathNavigator firstNode = MainDataSource.CreateNavigator().SelectSingleNode(&amp;quot;/dfs:myFields/dfs:dataFields/d:TestReferrals[1]&amp;quot;, NamespaceManager);
            firstNode.DeleteSelf();

            dataReader.Close();
            cnn.Close();</description></item></channel></rss>