Calendar Property |
Syntax
Calendar = calendarconstant
calendarconstant can be either of the following constants:
Constant | Value | Description |
---|---|---|
vbCalGreg | 0 | Application uses the Gregorian calendar (default) |
vbCalHijri | 1 | Application uses the Hijri calendar |
Description
Returns or sets a value specifying the type of calendar to use with your project. The Gregorian calendar year of 1998 (which is based on the birth of Christ) is roughly equivalent to the Hijri year of 1418 (which is based on the birth of Mohammed). Note that the new year of each calendar is different, and the Hijri calendar, being based more accurately on the cycles of the moon, is 11 days shorter than the Gregorian calendar.
Example
Calendar = vbCalHijri MsgBox Format(Now, "dd-mm-yyyy")
Programming Tips and Gotchas
Unless you are writing applications that will be used by or for users living or working in certain Muslim countries that use the Hijri calendar (for example, Saudi Arabia), you shouldn't need to set the Calendar property.
Get VB & VBA in a Nutshell: The Language now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.