Nota
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba mendaftar masuk atau menukar direktori.
Capaian ke halaman ini memerlukan kebenaran. Anda boleh cuba menukar direktori.
Returns a date in the specified format.
Syntax
expression. DateFormat( _Date_, _Format_ )
expression A variable that represents an Application object.
Parameters
| Name | Required/Optional | Data type | Description |
|---|---|---|---|
| Date | Required | Variant | The date to format. |
| Format | Optional | Long | The date format. Can be one of the PjDateFormat constants. The default value is pjDateDefault. |
Return value
Variant
Example
The following example displays the start of the selected task using the format "1/31/02 12:33 PM."
Sub OutputDate()
MsgBox DateFormat(ActiveCell.Task.Start, pjDate_mm_dd_yy_hh_mmAM)
End Sub
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.