We are transitioning over to a new forum platform. Please post new issues there. Existing threads will be dealt with here unless you choose to move them over. Visit the new forum

Forum

Thread tagged as: Question

Default values for dates/times

Is it possible to set default values in the date fieldtype?

The date is fine to default to whatever date the region is created on but the time value will pretty much always be the same. It needs to be editable, but it would be great to have the values start at 6 o'clock (or whatever I set using the default="" attribute in Perch).

Martin Underhill

Martin Underhill 5 points

  • 2 years ago
Drew McLellan

Drew McLellan 2638 points
Perch Support

Yes, I think so. What are you setting the default to?

I think I've got it working! Well, half-working… default="2004-06-04 17:00" seems to set the default whole thing ok, so that's good. I've tried default="%Y-%m-%d 17:00" in the hope that it gives today's date with a default time, but no joy – it sets the whole thing to the unix date start time '01-01-1970 01:00'. A wild card type character doesn't help either (default="**-**-** 17:00").

Drew McLellan

Drew McLellan 2638 points
Perch Support

Are you saying you want to set the default time, but not a default date? There's no option for that, it would need to be two fields.

That makes sense. At least I've got the default working :) I'll set it to 01-01-2017 18:00 and that'll be a reasonable starting point, at least. Cheers :)