---
title: "Add a certain number of minutes/hours/days/weeks/months to a date field"
canonical: "https://support.appfire.com/space/JMCF/465928271/Add%20a%20certain%20number%20of%20minutes%2Fhours%2Fdays%2Fweeks%2Fmonths%20to%20a%20date%20field"
format: markdown
---
> Macro (aura-html)

### Abstract

This code snippet adds a certain number of minutes/hours/days/weeks/months to a date field.

### Logic

Add the number of minutes/hours/days/weeks/months to the date field using [Use(TimeCategory](http://docs.groovy-lang.org/latest/html/api/groovy/time/TimeCategory.html)) 

### Snippet

```javascript
use (groovy.time.TimeCategory) {
     return <Date Object> + <Number of units>.<Unit>
 }
```

### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<Date Object`> | Access the date field | `issue.get("created")` |
| `<Number of units>` | The number of units to be added | `5` |
| `<Unit>` | `is one of "minutes","hours","days" "weeks" or "months"` | `months` |

### Examples

The output of this code snippet is a [Timestamp](http://docs.oracle.com/javase/7/docs/api/java/sql/Timestamp.html) which you could use in a Groovy expression, for example to:

- Calculate and display the issue creation plus 5 days in a Calculated Date/Time field
- Calculate and display the issue Due Date minus 3 months in a Calculated Date/Time field

### References

- [Variables and functions used in a Groovy script](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465732169)
- [Issue interface](https://appfire.atlassian.net/wiki/spaces/JMCF/pages/465764748)
- **[TimeCategory](http://docs.groovy-lang.org/latest/html/api/groovy/time/TimeCategory.html)**
- **[Groovy Documentation](http://groovy.codehaus.org/User+Guide)**

### Related articles

> Macro (contentbylabel)

> Macro (details)
> 
> | **Related issues** |  |
> | --- | --- |