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

### Abstract

This code snippet adds a certain number of minutes/hours/days/weeks/months to a Date/Date-Time picker field.

### Logic

<span style="color: #091e42">Add the number of minutes/hours/days/weeks/months to the date field using</span><span style="color: #091e42"> </span>[Use(TimeCategory](http://docs.groovy-lang.org/latest/html/api/groovy/time/TimeCategory.html)<span style="color: #091e42">) </span>

### Snippet 

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

### Placeholders

| **Placeholder** | **Description** | **Example** |
| --- | --- | --- |
| `<Date Object`> | Access a date field | `issue.get("created")` |
| `<Number of units>` | <span style="color: #091e42">The number of units to be added</span> | `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:

- Set a date field to issue created plus 5 days
- Set "Planned Delivery Date" as 1 month from today

### References

- [Variables used in a Groovy expression](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** |  |
> | --- | --- |