Set custom date field to default to current date and time

Get help from other users here.

Moderators: Developer, Contributor

Post Reply
pay2play

Set custom date field to default to current date and time

Post by pay2play »

Hello All,

I have created a custom date field for Date Closed which I need for reporting purposes. Currently the custom date field only shows 3 drop downs for year, month, and day. When submitted, the output shows the correct year, month, and day but with the time of 00:00:00. Is it possible to set custom date field to current date and time? Any help would be greatly appreciated!
pay2play

Re: Set custom date field to default to current date and tim

Post by pay2play »

I am running Mantis version 1.2.10
pay2play

Re: Set custom date field to default to current date and tim

Post by pay2play »

Anyone?? Any suggestions??
atrol
Site Admin
Posts: 8575
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Set custom date field to default to current date and tim

Post by atrol »

pay2play wrote:but with the time of 00:00:00
Where do you see the time?
pay2play wrote:Is it possible to set custom date field to current date and time?
Setting the current date is possible by setting the default value to

Code: Select all

{+0 days}
Please use Search before posting and read the Manual
pay2play

Re: Set custom date field to default to current date and tim

Post by pay2play »

The time stamp of 00:00:00 shows on the custom field column on the View Bug page and when the custom date field is exported to CSV,Excel. Setting the default date is not an issue, it's setting the field to the current date and time that I am trying to find a solution to.
atrol
Site Admin
Posts: 8575
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Set custom date field to default to current date and tim

Post by atrol »

pay2play wrote:The time stamp of 00:00:00 shows on the custom field column on the View Bug page and when the custom date field is exported to CSV,Excel.
Not in a standard installation with default settings. Did you set short_date_format?
Please use Search before posting and read the Manual
pay2play

Re: Set custom date field to default to current date and tim

Post by pay2play »

Yes, I changed the short_date_format in my config_inc file to include H:i. If not, the date submitted and updated fields will not show a time when they are exported.
pay2play

Re: Set custom date field to default to current date and tim

Post by pay2play »

Any suggestions on where to start?
atrol
Site Admin
Posts: 8575
Joined: 26 Mar 2008, 21:37
Location: Germany

Re: Set custom date field to default to current date and tim

Post by atrol »

There was a user who implemented DATETIME custom fields, but this was for version 1.1.4
http://www.mantisbt.org/bugs/view.php?id=6325
Please use Search before posting and read the Manual
pay2play

Re: Set custom date field to default to current date and tim

Post by pay2play »

I used the info in the link you provided, and the H:1 fields are now displayed as drop downs. The problem I am now having is when setting the default value of the field to {today} or {+0 days} my custom date field show the correct year, day, and month, however the H:1 fields are blank and must be chosen from a drop down.
pay2play

Re: Set custom date field to default to current date and tim

Post by pay2play »

I only needed this custom date field to display when an issue is closed, however when setting it to only display on close it would not default to the current date, month, year, and time. My work around was to just create a custom string in my custom_strings_inc file and rename due_date to Date Closed and then set the due_date field to display on the bug change page.
Post Reply