Date Entry format

8 posts by 4 authors in: Forums > CMS Builder
Last Post: October 22, 2008   (RSS)

By jamtc - October 18, 2008

Hi !

I want to show "DD MM YYYY" in input date entry of my date fields.

I can't see a way to do this...

Is it possible?

Will be possible in future versions of CMS?

Thanks...

Re: [jamtc] Date Entry format

By MisterJim - October 18, 2008 - edited: October 18, 2008

I'm not totally sure what it is you are asking, but if you want the date to display as dd mm yyyy, simply change the code in your viewer to read as such:

<?php echo date("d m Y", strtotime($record['fieldname']))?>

Make sure you change 'fieldname' to read the same as whatever the field name is for your date field.

Hope this is of some help.

Jim
WebCamp One, LLC



Websites That Work

Re: [Mr Jim] Date Entry format

By _kate_ - October 18, 2008

Hey Jim,
I think he's talking about the input field on the CMS side rather than what is outputted on the site.

There doesn't appear to be a way to change the default display of the date field in CMSB, however there may be - perhaps Dave or someone else can confirm whether or not it's possible?

Re: [jamtc] Date Entry format

By Dave - October 20, 2008

Do you want to use that format for showing dates on your website or for the form fields that a user enters a date into?

There's no automatic day to change the form fields right now but you could move their order around by editing /lib/menus/default/edit_functions.php (make a backup first then search for "use24HourFormat" to find the place where the date fields are displayed).

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Date Entry format

By jamtc - October 21, 2008

Thanks Kate and Dave...

I'll wait for this feature because it is very important to users of my region.

Date entry field must have "DD-MM-YYYY" entry format and showing format too....

[unimpressed]

Re: [jamtc] Date Entry format

By Dave - October 21, 2008

Hi jamtc,

And how should time be shown on the entry format? And is it 12 hour or 24 hour?
Dave Edis - Senior Developer
interactivetools.com

Re: [jamtc] Date Entry format

By Dave - October 22, 2008

Ok, I'll put this on the list for v1.24.

In the meantime, you can set 24 hour format in the field editor, and if you are comfortable editing PHP you can edit this file (make a backup) to swap the date field order:

/cmsAdmin/lib/menus/default/edit_functions.php

- make backup of file
- open file for editing
- search for ":mon"
- find these two lines:

print " <select name='{$fieldSchema['name']}:mon'>$monthOptions</select>\n";
print " <select name='{$fieldSchema['name']}:day'>$dayOptions</select>\n";

and swap them like this:

print " <select name='{$fieldSchema['name']}:day'>$dayOptions</select>\n";
print " <select name='{$fieldSchema['name']}:mon'>$monthOptions</select>\n";

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com