DateFormat Method
Returns a date in the specified format.
Syntax
expression**.DateFormat(Date, Format)**
*expression * Optional. An expression that returns an Application object.
Date Required Variant. The date to format.
PjDateFormat
Constant |
Date format applied to 9/30/02 (12:33 PM) |
---|---|
pjDateDefault | The default format, as specified on the View tab of the Options dialog box. |
pjDate_mm_dd_yy_hh_mmAM | 9/30/02 12:33 PM |
pjDate_mm_dd_yy | 9/30/02 |
pjDate_mm_dd_yyyy | 9/30/2002 |
pjDate_mmmm_dd_yyyy_hh_mmAM | September 30, 2002 12:33 PM |
pjDate_mmmm_dd_yyyy | September 30, 2002 |
pjDate_mmm_dd_hh_mmAM | Sep 30 12:33 PM |
pjDate_mmm_dd_yyy | Sep 30, '02 |
pjDate_mmmm_dd | September 30 |
pjDate_mmm_dd | Sep 30 |
pjDate_ddd_mm_dd_yy_hh_mmAM | Mon 9/30/02 12:33 PM |
pjDate_ddd_mm_dd_yy | Mon 9/30/02 |
pjDate_ddd_mmm_dd_yyy | Mon Sep 30, '02 |
pjDate_ddd_hh_mmAM | Mon 12:33 PM |
pjDate_mm_dd | 9/30 |
pjDate_dd | 30 |
pjDate_hh_mmAM | 12:33 PM |
pjDate_ddd_mmm_dd | Mon Sep 30 |
pjDate_ddd_mm_dd | Mon 9/30 |
pjDate_ddd_dd | Mon 30 |
pjDate_Www_dd | W40/1 |
pjDate_Www_dd_yy_hh_mmAM | W40/1/02 12:33 PM |
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
Applies to | Application Object
See Also | DateAdd Method | DateDifference Method | DateFormat Method | DateSubtract Method