drWireMORE
New Member
- Joined
- Jul 30, 2015
- Messages
- 6
From another thread, a MVP offered a solution which gives you UTC time in a cell. A user defined function similar but different than now()
It works flawlessly on my windows workstation, but presents a value error on my Apple Mac Workbook. Microsoft learn has not revealed why or how to fix it. Do understand behind the covers, the numbers/numeric values may be different, but this is an approved call. Pretty vanilla. (Function is the body of work from D, MVP, Canada)
In lieu of a UTC date/time value, on a Mac it returns #VALUE!
Excel/M365. Excel/Microsoft 365 Version 2312 enterprise.
Function GimmeUTC()
' Returns current date/time at UTC-GMT as an Excel serial date value
Dim dt As Object
Set dt = CreateObject("WbemScripting.SWbemDateTime")
dt.SetVarDate Now
GimmeUTC = dt.GetVarDate(False)
End Function
drW
It works flawlessly on my windows workstation, but presents a value error on my Apple Mac Workbook. Microsoft learn has not revealed why or how to fix it. Do understand behind the covers, the numbers/numeric values may be different, but this is an approved call. Pretty vanilla. (Function is the body of work from D, MVP, Canada)
In lieu of a UTC date/time value, on a Mac it returns #VALUE!
Excel/M365. Excel/Microsoft 365 Version 2312 enterprise.
SWbemDateTime object (Wbemdisp.h) - Win32 apps
The SWbemDateTime object is a helper object to parse and set Common Information Model (CIM) datetime values.
learn.microsoft.com
Function GimmeUTC()
' Returns current date/time at UTC-GMT as an Excel serial date value
Dim dt As Object
Set dt = CreateObject("WbemScripting.SWbemDateTime")
dt.SetVarDate Now
GimmeUTC = dt.GetVarDate(False)
End Function
drW