Back to Devexpress

PdfAcroFormValueFormat.CreateDateTimeFormat(String) Method

officefileapi-devexpress-dot-pdf-dot-pdfacroformvalueformat-dot-createdatetimeformat-x28-system-dot-string-x29.md

latest3.3 KB
Original Source

PdfAcroFormValueFormat.CreateDateTimeFormat(String) Method

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

Namespace : DevExpress.Pdf

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

NuGet Package : DevExpress.Pdf.Core

Declaration

csharp
public static PdfAcroFormValueFormat CreateDateTimeFormat(
    string format
)
vb
Public Shared Function CreateDateTimeFormat(
    format As String
) As PdfAcroFormValueFormat

Parameters

NameTypeDescription
formatString

Specifies the date and time format.

|

Returns

TypeDescription
PdfAcroFormValueFormat

An object that contains the date and time format.

|

Remarks

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

CodeDescriptionSample Result
dDisplays the day as a number, 1 to 31 .5
ddDisplays the day as a number, 01 to 31 .05
dddDisplays the 3-letter day of the week abbreviation according to the current culture.Fri
ddddDisplays the full day of the week according to the current culture.Friday
mDisplays the month as a number, 1 to 12.6
mmDisplays the month as a number, 01 to 12.06
mmmDisplays the 3-letter month abbreviation according to the current culture.Nov
mmmmDisplays the full month name according to the current culture.November
yyDisplays the 2-digit year.20
yyyyDisplays 4-digit year.2020
hDisplays the hour on 12-hour clock, 1 to 124
hhDisplays the hour on 12-hour clock, 01 to 1204
HDisplays the hour on 24-hour clock, 0 to 23.4 or 20
HHDisplays the hour on 24-hour clock, 00 to 23.04 or 20
MDisplays minutes, 0 to 59.8
MMDisplays minutes, 00 to 59.08
ttDisplays time using am/pm notation.04:20 am
ssDisplays seconds, 01 to 59.05

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

csharp
```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";
vb
'Create a text box with a date value:
Dim 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

PdfAcroFormValueFormat Class

PdfAcroFormValueFormat Members

DevExpress.Pdf Namespace