Good Morning,
I am having some trouble trying to get the timestamp using the local calendar. I would like to avoid using the datetime or any other third party object. i would like to remain strictly with in UNO:
import uno
from com.sun.star.lang import Locale
from com.sun.star.util import DateTime
def getUTCTime():
aLocale =Locale()
oLocaleCalendar2=createUnoService("com.sun.star.i18n.LocaleCalendar2")
oLocaleCalendar2.loadDefaultCalendarTZ(aLocale, "GMT+3")
localeTime = oLocaleCalendar2.getLocalDateTime
print(localeTime)
return localeTime-int(localeTime)
def main():
print(getUTCTime())
def createUnoService(serviceName):
cc = uno.getComponentContext()
sm = cc.ServiceManager
return sm.createInstanceWithContext(serviceName, cc)
this is based off of the information in
Apache OpenOffice Community Forum - How to get UTC DateTime in a spreadsheet or in Basic - (View topic)
and
LibreOffice Calc Macro, how do I get UTC hour? - English - Ask LibreOffice