<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="bbPress/1.0.1" -->
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Gravity Support Forums Topic: Convert date entry on submission</title>
		<link>https://legacy.forums.gravityhelp.com/topic/convert-date-entry-on-submission</link>
		<description>Gravity Support Forums Topic: Convert date entry on submission</description>
		<language>en-US</language>
		<pubDate>Sat, 04 Apr 2026 16:18:32 +0000</pubDate>
		<generator>http://bbpress.org/?v=1.0.1</generator>
		<textInput>
			<title><![CDATA[Search]]></title>
			<description><![CDATA[Search all topics from these forums.]]></description>
			<name>q</name>
			<link>https://legacy.forums.gravityhelp.com/search.php</link>
		</textInput>
		<atom:link href="https://legacy.forums.gravityhelp.com/rss/topic/convert-date-entry-on-submission" rel="self" type="application/rss+xml" />

		<item>
			<title>norcross on "Convert date entry on submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/convert-date-entry-on-submission#post-37718</link>
			<pubDate>Wed, 12 Oct 2011 13:51:12 +0000</pubDate>
			<dc:creator>norcross</dc:creator>
			<guid isPermaLink="false">37718@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Found a workaround that'll do what I want. I made two admin-only fields (as text field) and did the time conversion and had those post to the custom fields instead of the &#34;real&#34; date picker.&#60;/p&#62;
&#60;p&#62;The code if anyone wants it&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;// date corrections

function ctny_datesubmit_fix ($form){
    //event start date field id is 3
    //event end date field ID is 4
    $raw_srt = $_POST[&#38;#39;input_3&#38;#39;];
    $raw_end = $_POST[&#38;#39;input_4&#38;#39;];

	// convert my dates
	$fix_srt = strtotime($raw_srt);
	$fix_end = strtotime($raw_end);

	$_POST[&#38;#39;input_35&#38;#39;] = $fix_srt;
	$_POST[&#38;#39;input_36&#38;#39;] = $fix_end;
}

add_action(&#38;#39;gform_pre_submission_1&#38;#39;, &#38;#39;ctny_datesubmit_fix&#38;#39;);&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>norcross on "Convert date entry on submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/convert-date-entry-on-submission#post-37716</link>
			<pubDate>Wed, 12 Oct 2011 13:37:21 +0000</pubDate>
			<dc:creator>norcross</dc:creator>
			<guid isPermaLink="false">37716@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;OK. It works, but it won't post the UNIX time into the field on submission. As a test, I had the same input field (start date) post into a separate text field, and the converted time submits. Is there something with the date field that prevents anything other than a specifically formatted time to work?
&#60;/p&#62;</description>
		</item>
		<item>
			<title>David Smith on "Convert date entry on submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/convert-date-entry-on-submission#post-37711</link>
			<pubDate>Wed, 12 Oct 2011 12:05:42 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">37711@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Looks good. Just drop the form ID from the $_POST keys.&#60;/p&#62;
&#60;p&#62;Example: &#60;code&#62;input_1_3&#60;/code&#62; becomes &#60;code&#62;input_3&#60;/code&#62;
&#60;/p&#62;</description>
		</item>
		<item>
			<title>norcross on "Convert date entry on submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/convert-date-entry-on-submission#post-37710</link>
			<pubDate>Wed, 12 Oct 2011 11:53:06 +0000</pubDate>
			<dc:creator>norcross</dc:creator>
			<guid isPermaLink="false">37710@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;OK, I think I'm almost there, but I'm not sure it's firing correctly. Here are the variables:&#60;br /&#62;
Form ID: 1&#60;br /&#62;
Start Date: field 3&#60;br /&#62;
End Date: field 4&#60;/p&#62;
&#60;p&#62;and code:&#60;br /&#62;
&#60;pre&#62;&#60;code&#62;function ctny_datesubmit_fix ($form){
    //event start date field id is 3
    //event end date field ID is 4
    $raw_srt = $_POST[&#38;#39;input_1_3&#38;#39;];
    $raw_end = $_POST[&#38;#39;input_1_4&#38;#39;];

	// convert my dates
	$fix_srt = date(&#38;#39;u&#38;#39;, strtotime($raw_srt));
	$fix_end = date(&#38;#39;u&#38;#39;, strtotime($raw_end));

	$_POST[&#38;#39;input_1_3&#38;#39;] = $fix_srt;
	$_POST[&#38;#39;input_1_4&#38;#39;] = $fix_end;
}

add_action(&#38;#39;gform_pre_submission_1&#38;#39;, &#38;#39;ctny_datesubmit_fix&#38;#39;);&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>David Smith on "Convert date entry on submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/convert-date-entry-on-submission#post-37629</link>
			<pubDate>Tue, 11 Oct 2011 18:00:31 +0000</pubDate>
			<dc:creator>David Smith</dc:creator>
			<guid isPermaLink="false">37629@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;Hi Andrew,&#60;/p&#62;
&#60;p&#62;Sounds like you're on the right track. Using the &#60;a href=&#34;http://www.gravityhelp.com/documentation/page/Gform_pre_submission&#34; rel=&#34;nofollow&#34;&#62;gform_pre_submission&#60;/a&#62; filter you can update the submitted the values in the $_POST.&#60;/p&#62;
&#60;pre&#62;&#60;code&#62;[php]
$_POST[2] = date(&#38;#39;u&#38;#39;, strtotime($_POST[2]));&#60;/code&#62;&#60;/pre&#62;</description>
		</item>
		<item>
			<title>norcross on "Convert date entry on submission"</title>
			<link>https://legacy.forums.gravityhelp.com/topic/convert-date-entry-on-submission#post-37493</link>
			<pubDate>Mon, 10 Oct 2011 17:55:17 +0000</pubDate>
			<dc:creator>norcross</dc:creator>
			<guid isPermaLink="false">37493@https://legacy.forums.gravityhelp.com/</guid>
			<description>&#60;p&#62;I've got a form that takes a start and end date for events. I know I can convert the output on the theme into strtime, but I have a lot of functions and logic that is based on it being in a timestamp and making it convert on entry would make life easier. I'm pretty sure I can do it on the pre_submission filter, but I'm struggling with the logic.
&#60;/p&#62;</description>
		</item>

	</channel>
</rss>
