function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
EAF1EAF1 

Date + Time (Text field) to Date & Time fiels

Hoe to take two fields

1 Date 6/15/2009

2. Time (Text value)(9:30 PM)

and make them a Date & Time Field

 

 

JakesterJakester
This is a tough job. Just curious - how's your data integrity? How standardized are your dates and times? Also, is this a one-time job, or an ongoing one? If one-time, you're better off using something like Excel. If ongoing, can you change your process so you don't have to do this?
EAF1EAF1

Dates are standard Sforce Calendar values -- The Time are from a structured Pick List-

This is an ongoing process that needs to function in real time

I have read that it mau be possible to take a picklist value and convert it to TEXT and therafter convert it to a Time value

 

Any truth

 

JakesterJakester

You won't be able to do this without a higher level language. If you don't want to use Apex (which would be the best approach, if possible) you can use a workflow to send a SOAP message to an external server and then process it in any language you want. The last option would be a javascript button to click that would figure this out, but that's bad both because it requires users remembering to push a button and because javascript is going away eventually.

Kent ManningKent Manning
One question, why don't you just use a custom date/time field that is native to salesforce rather than trying to create a date time field from two other fields?  I may be missing something here, but would think that would be much easier.
Steve :-/Steve :-/

If your users are adamant about having separate fields for Date and Time, then you *might* be able to do something in VisualForce like what Salesforce does on the Event page.  

 

 

<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/29/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="11:00 AM" /> <span class="dateFormat">[&nbsp;<a href="#" onclick="var inputField = getElementByIdCS('StartDateTime_time');if (inputField && !inputField.disabled && inputField.value != '10:40 AM') { inputField.value = '10:40 AM'; if (inputField.onchange) {inputField.onchange();}}return false;">10:40&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>