Bug 166342 - LibreOffice Basic: Format(time, "hh-mm-ss") results in "hh:mm:ss" - nothing formatted
Summary: LibreOffice Basic: Format(time, "hh-mm-ss") results in "hh:mm:ss" - nothing f...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: BASIC (show other bugs)
Version:
(earliest affected)
25.2.0.3 release
Hardware: All All
: medium normal
Assignee: Mike Kaganski
URL:
Whiteboard: target:25.8.0
Keywords: bibisected, bisected, regression
Depends on:
Blocks:
 
Reported: 2025-04-25 16:44 UTC by aviador7000
Modified: 2025-05-08 15:42 UTC (History)
4 users (show)

See Also:
Crash report or crash signature:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description aviador7000 2025-04-25 16:44:03 UTC
Description:
Since update from version 24.8.4-2 to version 25.2.1-2 in libreoffice basic the function Function Format(time, "hh-mm-ss") in combination with oDateTime object does not work any more. Every time, if I use this function, it gives a value like "17:10:00" back. If I used it withe libreoffice 24.08.4, the value was correct like "17-10-00".

Version: 25.2.2.2 (X86_64) / LibreOffice Community
Build ID: 520(Build:2)
CPU threads: 8; OS: Linux 6.13; UI render: default; VCL: gtk3
Locale: de-DE (de_DE.utf8); UI: de-DE
25.2.2-1
Calc: CL threaded

Steps to Reproduce:
I wrote a small routine, for getting a timestamp like this:

Sub TimeStampMsgCUS()
    Dim oDateTime As Object
    Dim currentDate As String
    Dim currentTime As String
    Dim sTStamp as string
    
    ' Erstellen Timestamp
    oDateTime = createUnoService("com.sun.star.util.DateTime")
    currentDate = Format(Date, "yyyy-MM-dd")
    currentTime = Format(Time, "hh-mm-ss")    

    sTStamp = currentDate & "_" & _
              currentTime

	MsgBox(sTStamp)

End Sub

Before I used the Version > 25.1 - in my case the version 24.8.4 this worked correct.

Actual Results:
2025-04-25_18:27:13

Expected Results:
2025-04-25_18-27-13


Reproducible: Always


User Profile Reset: Yes

Additional Info:
I've tested thin on Manjaro Linux an Windows 10.
Comment 1 Robert Großkopf 2025-04-25 17:54:15 UTC
Could confirm formatting of time is impossible in Basic by 
Format(time, "HH-MM-SS").
Result will be "HH:MM:SS".

This works well up to LO 24.8.*, fails with LO 25.2.0.3 on OpenSUSE 15.6 64bit rpm Linux.
Comment 2 raal 2025-05-07 14:39:51 UTC
This seems to have begun at the below commit in bibisect repository/OS linux-64-25.2.
Adding Cc: to Mike Kaganski ; Could you possibly take a look at this one?
Thanks
 f1133a60850ed27a54cb3544c317e8f99b32da9e is the first bad commit
commit f1133a60850ed27a54cb3544c317e8f99b32da9e
Author: Jenkins Build User <tdf@maggie.tdf>
Date:   Fri Sep 13 00:35:09 2024 +0200

    source 81e1e0a2a671f19950c1bd3c69f9aa24b0c562e7

173254: Refactor SbxValue::Format | https://gerrit.libreoffice.org/c/core/+/173254
Comment 3 Mike Kaganski 2025-05-08 13:02:08 UTC
https://gerrit.libreoffice.org/c/core/+/185047
Comment 4 Commit Notification 2025-05-08 15:42:42 UTC
Mike Kaganski committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/commit/33434f16206aaa07f56af8f4c23b05b3c88a2124

tdf#166342: refactor SbxValue::Format again, to handle date/time strings

It will be available in 25.8.0.

The patch should be included in the daily builds available at
https://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
https://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.