Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use localized date format in Export-Excel #52

Closed
jhoneill opened this issue Dec 8, 2015 · 2 comments
Closed

Use localized date format in Export-Excel #52

jhoneill opened this issue Dec 8, 2015 · 2 comments

Comments

@jhoneill
Copy link
Contributor

jhoneill commented Dec 8, 2015

there are two places in Export-excel (line 257 and 297) where US dates are hard coded. I have replace the "m/d/yy h:mm" in mine so that it uses local format.

switch ($TargetData.$Name) {
{$_ -is [datetime]} {$targetCell.Style.Numberformat.Format = [cultureinfo]::CurrentCulture.DateTimeFormat.ShortDatePattern }
}

@Penkethboy
Copy link

Penkethboy commented May 19, 2018

version 4.0.13

I noticed that line 447 of Export-Excel.ps1 also has 'm/d/yy h:mm'

rather than the suggested fix by jhoneill to make it culture dependant

also its in Set-Rows line 115 and Set-columns line 111 as well

@jhoneill
Copy link
Contributor Author

Hi @Penkethboy
I went through the file and added some comments for this because there are some special cases where the underlying library recognises the format written in US style and stores it (in this case) as "format 14" which is "Short date". 'm/d/yy h:mm' is captured, but 'm/d/yy' isn't 'mm/dd/yy h:mm' isn't either. If the

The way I proposed originally would be great until I shared my file with someone who had a different culture set - then they would get a sheet with my local culture hard coded into it.

@dfinke dfinke closed this as completed Jun 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants