<?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>Controls</title><link>https://www.infopathdev.com:443/forums/43.aspx</link><description> </description><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Infopath 2010 addSeconds and DatePicker issues (bug or not...)</title><link>https://www.infopathdev.com:443/forums/thread/87874.aspx</link><pubDate>Sun, 10 Mar 2013 23:34:50 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:87874</guid><dc:creator>2e2forevesMan</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/87874.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=43&amp;PostID=87874</wfw:commentRss><description>&lt;p&gt;I had an Infopath2007 form that was used to record scheduled maintenance events.&amp;nbsp; The users would input the maintenance start and end times in UTC/ZULU format.&amp;nbsp; The customers and technicians would receive a report where the times were converted to local - this was all done in the form itself.&lt;/p&gt;&lt;p&gt;Here&amp;#39;s how:&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;ZuluStartTime: dateTime field selected with a Date Picker&lt;/p&gt;&lt;p&gt;DSTOffset: Integer field selected with drop-down choices that would add the appropriate offset for local time (central) conversion (-18,000 or -21,6000)&lt;/p&gt;&lt;p&gt;LocalStartTime: Read Only dateTime field with calculated value (addSeconds(ZuluStartTime,DSTOffset)&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;This worked great for years.&amp;nbsp; Then.... &lt;br /&gt;&lt;/p&gt;&lt;p&gt;The organization upgraded the clients to Infopath 2010, and after that point the converted times were off by 6 hours.&amp;nbsp; This corresponds to the time zone we are located in - so there was the correlation.&amp;nbsp; But I needed to see what changed (other then just create a work around).&lt;/p&gt;&lt;p&gt;&amp;nbsp;It could be 3 things - the DateTime data type, the Date Picker object, or the addSeconds function.&lt;/p&gt;&lt;p&gt;DateTime data type:&amp;nbsp; I created 2 variables - startTime and copyStartTime.&amp;nbsp; Both were DateTime types with a Date Picker.&amp;nbsp; I set copyStartTime&amp;#39;s default value to startTime.&amp;nbsp; This calculated correctly.&lt;/p&gt;&lt;p&gt;addSeconds function:&amp;nbsp; I created 3 variables - startTime and newStartTime (both DateTime types with a DatePicker) and offset (integer).&amp;nbsp; default values: startTime = now(), offset = 0, newStartTime = addSeconds(startTime, offset).&amp;nbsp;&amp;nbsp; Both startTime and newStartTime displated the same time.&amp;nbsp; However, when I selected differnt time using the date picker for startTime, newStartTime jumped forward 6 hours (remember offset is 0).&lt;br /&gt;&lt;/p&gt;&lt;p&gt;Turns out that the Date Picker field returns the time in a converted to UTC format.&amp;nbsp; (it displays local time, but the variable is stored as UTC)&amp;nbsp; So the user picks a time, and it is automatically converted to UTC and stored.&amp;nbsp; If you perform a calculation on that field (addSeconds), it is performing the action on the UTC time.&amp;nbsp; When you redisplay the modified dateTime, it now displays in UTC.&amp;nbsp; Infopath 2007 did not perform that way.&amp;nbsp; &lt;br /&gt;&lt;/p&gt;&lt;p&gt;AddSeconds is the only way to modify a dateTime that I am aware of.&amp;nbsp; It does not act as a infopath dev would expect it to act.&amp;nbsp; &lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I am not a Microsoft hater (I even support the ribbon in SOME applications -- not paint and not Sharepoint 2010), and this is really the first thing I think they made a mistake with that I have found. &lt;br /&gt;&lt;/p&gt;&lt;p&gt;Would you consider this a bug?&amp;nbsp; Or just another thing to work around and have break when the rules change again.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;laters. &lt;br /&gt;&lt;/p&gt;&lt;br /&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;br /&gt;&lt;/p&gt;</description></item></channel></rss>