Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONUnder review

Dow

Dow( dData ) --> nDia

Returns the weekday number.

DowAdvPL
01 · OVERVIEW

Overview

Dow uses Sunday=1 and Saturday=7; a blank date produces zero. This differs from Day, day of month, and CDow, English weekday name. The community example uses Date and depends on execution day; the adaptation uses a fixed SToD date for a verifiable expectation independent of configured input format. (TOTVS, n.d., ref. 1)

02 · SYNTAX

Syntax

Dow( dData ) --> nDia

Parameters

dData
DateRequired

Reference date.

Return value

Number from 0 to 7.

03 · PRACTICAL EXAMPLE

Commented example

#Include "Protheus.ch"

User Function Ed359()
    // Fixed Monday independent of the clock.
    ConOut(cValToChar(Dow(SToD("20261026"))))
Return Nil
Expected result

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

BEST PRACTICES
  • Do not assume ISO numbering with Monday=1.
  • Under review: editorial example neither compiled nor run in Protheus. Check includes, release, RDD and context before testing.

Related content

REFERENCES
  1. TOTVS. Dow. TDN. Accessed on 2026-10-26.
  2. EURAI. ADVPL/Funcoes/Data/Dow.PRW. universo_do_desenvolvedor_site, commit a5c83e9490302bdb4a0fc5a9d92c2d569a60773c. Exemplo analisado. Accessed on 2026-10-26.
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