+ Reply to Thread
Results 1 to 2 of 2

Format(Time(), "h:mm") gives format h.mm

  1. #1
    Registered User
    Join Date
    11-14-2019
    Location
    Finland
    MS-Off Ver
    2016
    Posts
    32

    Format(Time(), "h:mm") gives format h.mm

    Hi,
    I made a simple time reporting tool for a coworker. Every line of code that has to do with time includes formatting, example: Range().Value = Format(a_time_variant, "h:mm")

    I have a button "Start new task" executing a macro, which will set default values for a userform, then opens the form.
    In this form, modifiable textbox1.text will become the starting time of the task. I'll simplify a little but let's say this value is always Format(Time(), "h:mm") as default.
    When I open the form it shows exactly as it supposed to, and everything works fine. He's tried it with multiple computers and it worked fine.
    However:
    He now reported that when he clicks the button and form opens, Textbox1.text is in format: "h.mm"
    Now I don't understand how that is possible, even if the OS time format is different from mine, as all relevant form only operates with Format(… "h:mm")
    A second problem is that when format(textbox1.text, "h:mm") is copied to the designated cells, it becomes 0:00 if it was for some reason in the above format, h.mm
    Also, from what I understood from him, even if he types the time in h:mm to textbox1 it still copies as 0:00

    Why does this happen? Is there a way to make it "h:mm" no matter what? Is there a workaround that will copy textbox1.text to format "h:mm" no matter what?


    Here's the important pieces of code:

    Button set default value for textbox1.text:
    Please Login or Register  to view this content.
    Form button copies the new task, puts textbox1.text as starting time
    Please Login or Register  to view this content.

  2. #2
    Registered User
    Join Date
    11-14-2019
    Location
    Finland
    MS-Off Ver
    2016
    Posts
    32

    Re: Format(Time(), "h:mm") gives format h.mm

    Just to add, he sent me the file back when he was having problems. I tried starting a new task and it worked perfectly. If I typed 0.14 it would become 0:00

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1