Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONPublished

AdjustDate

AdjustDate( <dData>, <nDias> ) --> dData

Calculates a date by moving forward or backward through business days.

DateChronologicalBusiness daysEssential functions
01 · OVERVIEW

Overview

AdjustDate() is used when a routine must move a date while respecting business days. It is common in due dates, operational deadlines and calculations that should avoid weekends or configured holidays.

02 · SYNTAX

Syntax

AdjustDate( <dData>, <nDias> ) --> dData

Parameters

dData
DataRequired

Starting date for the calculation.

nDias
NuméricoRequired

Number of business days to move. Use a negative value to go back.

03 · PRACTICAL EXAMPLE

Calcular prazo em cinco dias úteis

#Include "TOTVS.ch"

User Function ExAdjustDate()
    Local dDeadline := AdjustDate(Date(), 5)

    MsgInfo("Calculated deadline: " + DToC(dDeadline))
Return
Expected result

Calculates a date five business days after the current date.

BEST PRACTICES
  • Use para prazos que precisam considerar calendário útil.
  • Segundo a referência RXM, feriados dependem de configuração/tabela do ambiente; sem isso, a rotina tende a tratar principalmente fins de semana.
COMMON PITFALLS
  • Não assuma calendário fiscal ou bancário sem validar a configuração do ambiente.
  • Quando o resultado impactar vencimento financeiro, documente a regra aplicada.

Related content

REFERENCES
  1. RXM Tecnologia. 20 essential AdvPL functions every Protheus developer uses. May 2026.
Status
Published
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