Set custom date field to default to current date and time

Get help from other users here.

Moderators: Developer, Contributor

Set custom date field to default to current date and time

Postby pay2play » Jun 01, 2012 4:01 pm

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
 
Posts: 13
Joined: Jun 01, 2012 3:57 pm

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

Postby pay2play » Jun 04, 2012 1:50 pm

I am running Mantis version 1.2.10
pay2play
 
Posts: 13
Joined: Jun 01, 2012 3:57 pm

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

Postby pay2play » Jun 05, 2012 11:07 am

Anyone?? Any suggestions??
pay2play
 
Posts: 13
Joined: Jun 01, 2012 3:57 pm

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

Postby atrol » Jun 05, 2012 2:31 pm

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
Use Mantis2Go to try MantisBT on Windows or to reproduce issues
atrol
 
Posts: 3642
Joined: Mar 26, 2008 4:37 pm
Location: Germany

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

Postby pay2play » Jun 07, 2012 9:05 am

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.
pay2play
 
Posts: 13
Joined: Jun 01, 2012 3:57 pm

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

Postby atrol » Jun 07, 2012 3:03 pm

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
Use Mantis2Go to try MantisBT on Windows or to reproduce issues
atrol
 
Posts: 3642
Joined: Mar 26, 2008 4:37 pm
Location: Germany

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

Postby pay2play » Jun 07, 2012 3:32 pm

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
 
Posts: 13
Joined: Jun 01, 2012 3:57 pm

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

Postby pay2play » Jun 09, 2012 11:18 am

Any suggestions on where to start?
pay2play
 
Posts: 13
Joined: Jun 01, 2012 3:57 pm

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

Postby atrol » Jun 10, 2012 3:58 am

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
Use Mantis2Go to try MantisBT on Windows or to reproduce issues
atrol
 
Posts: 3642
Joined: Mar 26, 2008 4:37 pm
Location: Germany

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

Postby pay2play » Jun 11, 2012 1:57 pm

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
 
Posts: 13
Joined: Jun 01, 2012 3:57 pm

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

Postby pay2play » Jun 14, 2012 9:35 am

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.
pay2play
 
Posts: 13
Joined: Jun 01, 2012 3:57 pm


Return to Help

Who is online

Users browsing this forum: No registered users and 12 guests

cron