Skip to main content

PdfAcroFormValueFormat.CreateDateTimeFormat(String) Method

Create a date and time format for a form field value.

Namespace: DevExpress.Pdf

Assembly: DevExpress.Pdf.v23.2.Core.dll

NuGet Package: DevExpress.Pdf.Core

Declaration

public static PdfAcroFormValueFormat CreateDateTimeFormat(
    string format
)

Parameters

Name Type Description
format String

Specifies the date and time format.

Returns

Type Description
PdfAcroFormValueFormat

An object that contains the date and time format.

Remarks

You can use the following codes to specify date and time format:

Code Description Sample Result
d Displays the day as a number, 1 to 31 . 5
dd Displays the day as a number, 01 to 31 . 05
ddd Displays the 3-letter day of the week abbreviation according to the current culture. Fri
dddd Displays the full day of the week according to the current culture. Friday
m Displays the month as a number, 1 to 12. 6
mm Displays the month as a number, 01 to 12. 06
mmm Displays the 3-letter month abbreviation according to the current culture. Nov
mmmm Displays the full month name according to the current culture. November
yy Displays the 2-digit year. 20
yyyy Displays 4-digit year. 2020
h Displays the hour on 12-hour clock, 1 to 12 4
hh Displays the hour on 12-hour clock, 01 to 12 04
H Displays the hour on 24-hour clock, 0 to 23. 4 or 20
HH Displays the hour on 24-hour clock, 00 to 23. 04 or 20
M Displays minutes, 0 to 59. 8
MM Displays minutes, 00 to 59. 08
tt Displays time using am/pm notation. 04:20 am
ss Displays seconds, 01 to 59. 05

The code sample below shows how to create a text box field with a date value:

```csharp
//Create a text box with a date value:
var textBox = new PdfAcroFormTextBoxField("date", 1, new PdfRectangle(10, 20, 100, 50));
textBox.ValueFormat = 
PdfAcroFormValueFormat.CreateDateTimeFormat("mm/dd/yyyy");
textBox.Text = "01/20/2020";
See Also