Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

Month

Month(dData) -> nMonth

Extracts the month from an AdvPL date.

MonthAdvPL
01 · OVERVIEW

Overview

The result is 1–12 for populated dates and zero for an empty date. It takes a Date value rather than a locally formatted string. The example uses SToD for an unambiguous date. (Sources: refs. 1–1.)

02 · SYNTAX

Syntax

Month(dData) -> nMonth

Parameters

dData
DateRequired

Date to inspect.

Return value

Integer 0–12 according to the date.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed529()
    // Input typed as Date.
    ConOut(cValToChar(Month(SToD("20261027"))))
Return Nil
Expected result

Result: 10. Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

BEST PRACTICES
  • Validate empty dates before using the result to index a month list.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Month. TDN. Accessed on 2026-10-27.
Status
Under review
Page created on
Last reviewed on
Original language
Portuguese
Reviewed by
Usina.BR
0 approved comment(s)

Comments

There are no approved comments yet.

Sign in with Google or Microsoft to comment.

Powered by Usina Docs · Alpha