+ Start a Discussion
pierrefrazny.ax358pierrefrazny.ax358 

Date/Time field vs Date + Time fields

My end goal is to populate a Date/Time field. 

My users would rather use 2 fields to enter date and time rather than the SF Date/Time field. I created a date field (Activity_Date) and text field (Activity_Time). I added a validation rule to make sure Activity_Time would be properly formatted (ex: 8:30 or 16:15). Now I realize that the SF Date/Time field is very convenient in order to sort records. Is there a formula I could use to recombine these 2 fields to populate a Date/Time field?

Thanks!

Pierre 

Steve MolisSteve Molis

I think you might have to create a hidden field called a workarea to concatenate and reformat the information from your separate Date and Time input fields and then dump that into another hidden Date/Time field that you can use for reports, lists, and sorting. 

 

 

Just out of curiosity, is this a "done deal" using the 2 separate fields for Date and Time?  or is this just something the users want? 

 

Because when I was 5, I really wanted a BB-Gun for Christmas and I didn't get it (which was probably a good thing)  

pierrefrazny.ax358pierrefrazny.ax358

Thanks for the reply. I understand your point. This is not a done deal but the users have been used to having separate fields for date and time.

I am able to concatenate Date and Time into one text field. Then I don't know how to copy this value into a Date/Time field. Any clue?

Thanks

Pierre 

Steve MolisSteve Molis

I've got some bad news, and I've got some good news....

 

The bad news is:  It does not look like SFDC Formula Language can convert Text or Numeric values into a DateTime datatype 

 

The good news is:  This means you can tell your users "It can't be done, you're just gonna have to use the standard SFDC DateTime fields"   :smileyvery-happy:

 

 

You *might* be able to do it with a more advanced language like Java or JavaScript, but that's outta my league.  That appears to be what SFDC does on the Event page for the Start and End DateTime fields  

 

<input id="evt5" maxlength="80" name="evt5" size="20" tabindex="2" type="text" /><a href="javascript:openPopupFocus%28%27%2Fwidg%2Fcombobox.jsp%3Fform%3DeditPage%26field%3Devt5%26display%3D1%26cnt%3D5%27%2C%20%27_blank%27%2C%20270%2C%20200%2C%20%27width%3D270%2Cheight%3D200%2Cresizable%3Dyes%2Ctoolbar%3Dno%2Cstatus%3Dno%2Cscrollbars%3Dyes%2Cmenubar%3Dno%2Cdirectories%3Dno%2Clocation%3Dno%2Cdependant%3Dyes%27%2C%20true%2C%20true%29%3B" onclick="setLastMousePosition(event)" tabindex="2" title="Combo (New Window)"><img src="/s.gif" alt="Subject Combo (New Window)" class="comboboxIcon" onblur="this.className = 'comboboxIcon';" onfocus="this.className = 'comboboxIconOn';" onmouseout="this.className = 'comboboxIcon';this.className = 'comboboxIcon';" onmouseover="this.className = 'comboboxIconOn';this.className = 'comboboxIconOn';" title="Subject Combo (New Window)"/></a></div></td><td class="labelCol requiredInput"><label for="StartDateTime"><span class="requiredMark">*</span>Start</label></td><td class="dataCol"><div class="requiredInput"><div class="requiredBlock"></div><span class="dateInput dateOnlyInput"><input id="StartDateTime" name="StartDateTime" onchange="ActivityFunction.updateDates(&#39;StartDateTime&#39;, [&#39;reminder_dt&#39;,&#39;RecurrenceStartDateTime&#39;,&#39;EndDateTime&#39;]);ActivityFunction.updateCalendar([&#39;evt1&#39;,&#39;evt1_lkid&#39;,&#39;StartDateTime&#39;,&#39;evt15&#39;,&#39;hh&#39;,&#39;mi&#39;,&#39;IsRecurrence&#39;,&#39;RecurrenceStartDateTime&#39;,&#39;RecurrenceEndDateOnly&#39;,&#39;rectype&#39;,&#39;recd&#39;,&#39;recm&#39;,&#39;recy&#39;,&#39;invtee&#39;]);ActivityFunction.checkDuration(&#39;IsRecurrence&#39;,&#39;evt15&#39;,&#39;StartDateTime&#39;,&#39;StartDateTime_time&#39;,&#39;EndDateTime&#39;,&#39;EndDateTime_time&#39;);" onfocus="DatePicker.pickDate(true, 'StartDateTime', false);" size="10" tabindex="10" type="text" value="6/25/2009" /><span class="timeInput"><input autocomplete="off" id="StartDateTime_time" name="StartDateTime_time" onchange="ActivityFunction.updateEndTime(&#39;StartDateTime&#39;,&#39;StartDateTime_time&#39;, &#39;EndDateTime&#39;, &#39;EndDateTime_time&#39;);ActivityFunction.checkDuration(&#39;IsRecurrence&#39;,&#39;evt15&#39;,&#39;StartDateTime&#39;,&#39;StartDateTime_time&#39;,&#39;EndDateTime&#39;,&#39;EndDateTime_time&#39;);" onfocus="ActivityFunction.saveStartTime(&#39;StartDateTime&#39;,&#39;StartDateTime_time&#39;);ActivityFunction.showTimePicker(&#39;StartDateTime_time&#39;);" size="8" tabindex="11" type="text" value="9:00 AM" /> <span class="dateFormat">[&nbsp;<a href="#" onclick="var inputField = getElementByIdCS('StartDateTime_time');if (inputField && !inputField.disabled && inputField.value != '8:08 AM') { inputField.value = '8:08 AM'; if (inputField.onchange) {inputField.onchange();}}return false;">8:08&nbsp;AM</a>&nbsp;]</span></span></span></div></td></tr> <tr><td class="labelCol"><label for="evt2_top">Name</label></td><td class="dataCol col02"><div id="evt2_top" name="evt2_top" style="white-space: nowrap"><select id="evt2_mlktp" name="evt2_mlktp" onchange="getElementByIdCS('evt2_lktp').value=getElementByIdCS('evt2_mlktp').options[getElementByIdCS('evt2_mlktp').selectedIndex].value;getElementByIdCS('evt2_lkid').value='';getElementByIdCS('evt2_mod').value='1';ActivityFunction.adjwht('evt2_mlktp');" tabindex="3" title="Object Type"><option value="003" selected="selected">Contact</option> <option value="00Q">Lead</option> </select><input type="hidden" name="evt2_lkid" id="evt2_lkid" value="000000000000000" /><input type="hidden" name="evt2_lkold" id="evt2_lkold" value="null" /><input type="hidden" name="evt2_lktp" id="evt2_lktp" value="003" /><input type="hidden" name="evt2_lspf" id="evt2_lspf" value="0" /><input type="hidden" name="evt2_mod" id="evt2_mod" value="0" /><input type="hidden" id="evt2_onpk" name="evt2_onpk" value="ActivityFunction.adjustPrivate('evt2','evt3','IsPrivate');" /><span class="lookupInput"><input autocomplete="off" id="evt2" maxlength="255" name="evt2" onchange="getElementByIdCS('evt2_lkid').value='';getElementByIdCS('evt2_mod').value='1';ActivityFunction.adjustPrivate('evt2','evt3','IsPrivate');" size="20" tabindex="4" title="Name" type="text" /><script type="text/javascript">new AutoCompleteInputElement('evt2','\/_ui\/common\/data\/MRUAutoCompleteServlet',0,{'lknm':'evt2','acEntity':'Contact','lkrf':null,'lkfm':'editPage'});</script><a

 

 

 

Message Edited by Stevemo on 06-25-2009 11:11 AM