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

Formatting with \ #6

Open
angex opened this issue Apr 21, 2020 · 1 comment
Open

Formatting with \ #6

angex opened this issue Apr 21, 2020 · 1 comment

Comments

@angex
Copy link

angex commented Apr 21, 2020

I am having issue with VBA.Format$ - this could be related to my regional settings (finnish)

For some reason function ConvertToIso(utc_LocalDate As Date) As String with parameter "27.4.2020 17.00.00":
VBA.Format$(ConvertToUtc(utc_LocalDate), "yyyy-mm-ddTHH:mm:ss.000Z")
->converts to "2020-04-27T14.00.00.000Z" (not correct)
If I modify it to
VBA.Format$(ConvertToUtc(utc_LocalDate), "yyyy-mm-ddTHH:mm:ss.000Z")
->converts to "2020-04-27T14:00.00.000Z" (not correct but one . is : as it shuold be)
So correct one would be:
VBA.Format$(ConvertToUtc(utc_LocalDate), "yyyy-mm-ddTHH:mm:ss.000Z")

See at bottom for ():
https://docs.microsoft.com/en-us/office/vba/language/reference/user-interface-help/format-function-visual-basic-for-applications

@Nick-vanGemeren
Copy link

This issue report looked weird at first because nothing changed in the displayed code. Given the issue title, I think several backslashes are not displayed because they're not formatted as code.
The ISO standard wants specific separators which should not be regionalised. So the time and decimal separators need to be escaped with backslash:

ConvertToIso = VBA.Format$(ConvertToUtc(utc_LocalDate), "yyyy-mm-ddTHH\:mm\:ss\.000Z")
(Looks OK in Preview)

The '-' T and Z could be escaped but don't mean anything to Format.

@Naami786 Naami786 mentioned this issue Aug 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants