Usina BRAdvPL Guide
Sign in
← All topics
FUNCTIONPublished

DToS

DToS( <dData> )

Converts a date to text in YYYYMMDD format.

ConversionDate
01 · OVERVIEW

Overview

Returns an eight-character date representation ordered from year to day, commonly used in technical values and sortable expressions.

02 · SYNTAX

Syntax

DToS( <dData> )
03 · PRACTICAL EXAMPLE

Date in sortable format

Local dStart := CTOD("08/01/2026")
Local cSqlDate := DToS(dStart)

ConOut(cSqlDate) // 20260801
Expected result

The date is returned as eight characters in year, month and day order.

BEST PRACTICES
  • Do not concatenate the result into SQL statements without proper parameterization.
  • YYYYMMDD preserves chronological order when sorted as text.

Related content

REFERENCES
  1. TOTVS. Developing queries in Protheus. TDN.
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