Documentation

date.month() function

date.month() returns the month of a specified time. Results range from [1 - 12].

Returned valueMonth
1January
2February
3March
4April
5May
6June
7July
8August
9September
10October
11November
12December
Function type signature
(t: A, ?location: {zone: string, offset: duration}) => int where A: Timeable
  • Copy
  • Fill window

For more information, see Function type signatures.

Parameters

t

(Required) Time to operate on.

Use an absolute time, relative duration, or integer. Durations are relative to now().

location

Location used to determine timezone. Default is the location option.

Examples

Return the month of a time value

import "date"

date.month(t: 2020-02-11T12:21:03.29353494Z)// Returns 2
  • Copy
  • Fill window

Return the month of a relative duration

import "date"

option now = () => 2020-02-11T12:21:03.29353494Z

date.month(t: -3mo)// Returns 8
  • Copy
  • Fill window

Return the current numeric month

import "date"

date.month(t: now())
  • Copy
  • Fill window

Was this page helpful?

Thank you for your feedback!


The future of Flux

Flux is going into maintenance mode. You can continue using it as you currently are without any changes to your code.

Read more

New in InfluxDB 3.3

Key enhancements in InfluxDB 3.3 and the InfluxDB 3 Explorer 1.1.

See the Blog Post

InfluxDB 3.3 is now available for both Core and Enterprise, which introduces new managed plugins for the Processing Engine. This makes it easier to address common time series tasks with just a plugin. InfluxDB 3 Explorer 1.1 is also available, which includes InfluxDB plugin management and other new features.

For more information, check out: