<![CDATA[ createdon date format - My Forums]]> https://forums.modx.com/thread/?thread=103779 <![CDATA[createdon date format]]> https://forums.modx.com/thread/103779/createdon-date-format?page=2#dis-post-558196
When I reformat the default createdon date (2018-04-14 01:42:55) to a simple month/day/year I get an incorrect date: February 27, 2015. Not sure where that date is coming from.

I followed Bob's article https://bobsguides.com/blog.html/2013/09/18/displaying-modx-date-fields/.
[[!DateFormat? &field=`createdon` &formatString=`%b %d, %Y`]]
]]>
todd.b Apr 25, 2018, 04:08 AM https://forums.modx.com/thread/103779/createdon-date-format?page=2#dis-post-558196
<![CDATA[Re: createdon date format]]> https://forums.modx.com/thread/103779/createdon-date-format?page=2#dis-post-558277
Anyone reading who has similar issues/questions should go ahead and jump in now while the water is fine!]]>
nuan88 Apr 28, 2018, 09:45 PM https://forums.modx.com/thread/103779/createdon-date-format?page=2#dis-post-558277
<![CDATA[Re: createdon date format]]> https://forums.modx.com/thread/103779/createdon-date-format?page=2#dis-post-558273 andytough Apr 28, 2018, 09:36 AM https://forums.modx.com/thread/103779/createdon-date-format?page=2#dis-post-558273 <![CDATA[Re: createdon date format]]> https://forums.modx.com/thread/103779/createdon-date-format?page=2#dis-post-558269 BobRay Apr 28, 2018, 03:53 AM https://forums.modx.com/thread/103779/createdon-date-format?page=2#dis-post-558269 <![CDATA[Re: createdon date format (Best Answer)]]> https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558253
So the problem isn't the placeholder or the ClassExtender field, it's that my PHP wasn't generating the date, but I found the problem. I changed it from this:
<?php
echo date('F j, Y')

to
<?php
echo date("F j, Y");
]]>
todd.b Apr 27, 2018, 12:34 AM https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558253
<![CDATA[Re: createdon date format]]> https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558250
[[!SetUserPlaceholders]] 
]]>
BobRay Apr 26, 2018, 09:53 PM https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558250
<![CDATA[Re: createdon date format]]> https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558247 <?php echo dateā€¦ gets written to the db and not the actual date.

Manually entering the date works perfectly.

Ok, then is the solution to put <?php echo date('F j, Y') ?> in a snippet then call it from the Chunk?
]]>
todd.b Apr 26, 2018, 05:10 PM https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558247
<![CDATA[Re: createdon date format]]> https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558236
<input name="registerDate" id="registerDate" value="<?php echo date('F-j-Y') ?>" type="hidden">

Then displayed it on the Profile page as
[[+registerDate]]


If you go to the Manager is the date stored in the users profile?

If it isn't showing in the manager, can you enter a date there and see if it saves?

If it doesn't save from the manager then your field has not been created correctly by ClassExtender.

If it does save from the manager does it display using your profile page code?

[[+registerDate]]
]]>
andytough Apr 26, 2018, 07:35 AM https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558236
<![CDATA[Re: createdon date format]]> https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558233
Ok, so with that being the case I used ClassExtender to create a new registerDate field and included it in the Register form as a hidden field,
<input type="hidden" name="registerDate" id="registerDate" value="<?php echo date('F-j-Y') ?>">

Then displayed it on the Profile page as
[[+registerDate]]

But the result is empty.]]>
todd.b Apr 26, 2018, 04:07 AM https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558233
<![CDATA[Re: createdon date format]]> https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558225 user profile field.]]> BobRay Apr 25, 2018, 10:04 PM https://forums.modx.com/thread/103779/createdon-date-format#dis-post-558225