[#BloombergLP-bdlt-Datetime-printToBuffer]
= xref:BloombergLP.adoc[BloombergLP]::xref:BloombergLP/bdlt.adoc[bdlt]::xref:BloombergLP/bdlt/Datetime.adoc[Datetime]::printToBuffer
:relfileprefix: ../../../
:mrdocs:

Write a textual representation of this object into `result`&period;

== Synopsis

Declared in `&lt;bdlt&lowbar;datetime&period;h&gt;`

[source,cpp,subs="verbatim,replacements,macros,-callouts"]
----
int
printToBuffer(
    char* result,
    int numBytes,
    int fractionalSecondPrecision = 6) const;
----

== Description

Efficiently write to the specified `result` buffer no more than the specified `numBytes` of a representation of the value of this object&period; Optionally specify `fractionalSecondPrecision` digits to indicate how many fractional second digits to output&period; If `fractionalSecondPrecision` is not specified then 6 fractional second digits will be output (3 digits for milliseconds and 3 digits for microseconds)&period; Return the number of characters (not including the null character) that would have been written if the limit due to `numBytes` were not imposed&period; `result` is null&hyphen;terminated unless `numBytes` is 0&period; The behavior is undefined unless `0 &lt;&equals; numBytes`, `0 &lt;&equals; fractionalSecondPrecision &lt;&equals; 6`, and `result` refers to at least `numBytes` contiguous bytes&period; Note that the return value is greater than or equal to `numBytes` if the output representation was truncated to avoid `result` overrun&period;

== Return Value

the number of characters that would have been written

== Parameters

[cols="1,4"]
|===
| Name| Description
| *result*
| output character buffer
| *numBytes*
| capacity of `result` in bytes
| *fractionalSecondPrecision*
| fractional second digits to write (default 6)
|===


[.small]#Created with https://www.mrdocs.com[MrDocs]#
