Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Set-OfficeExcelDateSystem

Aliases: ExcelDateSystem
Module
PSWriteOffice
Aliases
ExcelDateSystem
Inputs
OfficeIMO.Excel.ExcelDocument

Sets the workbook date system (1900 or 1904).

Syntax

Set-OfficeExcelDateSystem
[-DateSystem] <NineteenHundred|NineteenFour>
[-Document <ExcelDocument>]
[-PassThru]
[<CommonParameters>]
#
Parameter set: Default

Examples

Use the 1904 date system

Open-OfficeExcel -Path .\Finance\Legacy-Ledger.xlsx {
    ExcelDateSystem 1904
}

Switches the workbook to the 1904 date system used by some older Mac workbooks.

Match a partner workbook before copying dates

New-OfficeExcel -Path .\Finance\Consolidated.xlsx {
    ExcelDateSystem 1904
    Copy-OfficeExcelSheet -Source .\Partners\Ledger-1904.xlsx -Sheet Ledger
}

Sets the date system of a new workbook to match a 1904-based partner file before copying its sheets in.

Parameters

-DateSystem ExcelDateSystem requiredposition: 0
Date system to use for Excel date serials.
Possible values: NineteenHundred, NineteenFour
-Document ExcelDocument optionalpipeline: True (ByValue)
Caller-owned workbook; omission uses the enclosing Excel content block.
-PassThru SwitchParameter optional
Emits the native result after the operation.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.