[Solved] Time seconds function - two decimals output

Creating a macro - Writing a Script - Using the API

[Solved] Time seconds function - two decimals output

Postby Ponny » Fri Apr 21, 2017 4:14 pm

Meow

About time functions. I remember in Word Basic from MS Word 6, function Second returns seconds and 100 miliseconds and 10 miliseconds. Something about this example: "3,14". Seconds of corse. From input variable with serial date&time.

Now in OpenOffice Basic (OpenOffice 3.1.2) function Second returns only seconds without decimals. Is there any hope to get time - seconds with two decimals? Maybe 3?

Thankyou for any good news about this :)
But if this is not possible, then I apologize for stupid question :oops:


Ponny
Last edited by Ponny on Sat Apr 22, 2017 8:15 pm, edited 1 time in total.
MS Windows 10: OpenOffice 4.1.3
User avatar
Ponny
 
Posts: 117
Joined: Sun Jun 21, 2009 7:34 pm
Location: Mystical Kingdom of Krakovo

Re: Time seconds function - two decimals output

Postby Zizi64 » Fri Apr 21, 2017 9:22 pm

The Cell Function NOW() supports the fractions of the seconds. You can calculate the seconds and the fraction part of the seconds by a macro or by some cell functions.

Note: The resolution of the StarBasic function NOW() is 1 second. There is no fraction.

SecFrac.ods
(12.06 KiB) Downloaded 33 times
Tibor Kovacs, Hungary; LO4.4.7, LO5.3.7 on Win7x64Prof.
PortableApps, WinPenPack: LO3.3.0-LO5.4.2 and AOO4.1.3
Please, edit the topic's initial post, and add the word "[Solved]" at the beginning of the subject line - if your problem has been solved.
User avatar
Zizi64
Volunteer
 
Posts: 5999
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Time seconds function - two decimals output

Postby JeJe » Fri Apr 21, 2017 10:01 pm

getSystemTicks
Openoffice 4.1.2
Windows 8
JeJe
 
Posts: 122
Joined: Wed Mar 09, 2016 2:40 pm

Re: Time seconds function - two decimals output

Postby F3K Total » Sat Apr 22, 2017 10:11 am

Code: Select all   Expand viewCollapse view
Sub F_get_NOW as string
   oFunctionAccess = createUnoService("com.sun.star.sheet.FunctionAccess")
   dDateTime = oFunctionAccess.callFunction("NOW", Array())
   dTime = dDateTime - Int(dDateTime)   
   sTime = Format(dTime,"HH:MM:SS.00")
   msgbox ("Current Timestamp:" & CHR(13) & sTime,64,"Date Time -> seconds with two decimal places")
End Sub
    MMove 1.0.6
  • Extension for easy, exact positioning of shapes, pictures, controls, frames ...
    my current system
  • Windows 7 OOo, AOO, LOLinux Mint OOo, AOO, LO
F3K Total
Volunteer
 
Posts: 891
Joined: Fri Dec 16, 2011 8:20 pm

Re: Time seconds function - two decimals output

Postby Ponny » Sat Apr 22, 2017 8:14 pm

It works!

Thank you ;) :bravo:

Ponny
MS Windows 10: OpenOffice 4.1.3
User avatar
Ponny
 
Posts: 117
Joined: Sun Jun 21, 2009 7:34 pm
Location: Mystical Kingdom of Krakovo


Return to Macros and UNO API

Who is online

Users browsing this forum: Google [Bot] and 10 guests