Page 2 of 2 FirstFirst 12
Results 11 to 12 of 12

Thread: dt_setdateseparator not working?

  1. #11
    thinBasic author ErosOlmi's Avatar
    Join Date
    Sep 2004
    Location
    Milan - Italy
    Age
    57
    Posts
    8,777
    Rep Power
    10

    Re: dt_setdateseparator not working?

    @Roberto
    Thanks. I will update module (and other matters) asap when released new thinBasic preview version.

    @Fred
    Please download attached file in Roberto's post and replace your current local file under \thinBasic\Lib\. It is the new version of DT (Date) module.

    Ciao
    Eros
    www.thinbasic.com | www.thinbasic.com/community/ | help.thinbasic.com
    Windows 10 Pro for Workstations 64bit - 32 GB - Intel(R) Xeon(R) W-10855M CPU @ 2.80GHz - NVIDIA Quadro RTX 3000

  2. #12

    Re: dt_setdateseparator not working?

    Quote Originally Posted by ErosOlmi
    @Roberto
    Thanks. I will update module (and other matters) asap when released new thinBasic preview version.

    @Fred
    Please download attached file in Roberto's post and replace your current local file under \thinBasic\Lib\. It is the new version of DT (Date) module.
    Roberto and Eros,

    Thanks so much for this and for turning the change around so quickly.

    I've installed and tested it and it works exactly right, with the date separator working just like one would expect.

    The milliseconds code is a really nice addition to thinBasic, making it practical for timing applications that it could never be used for previously.

    If you ever consider a major rewrite of DT (or a new module): Consider using floating point to store a single value for both the date and time. Everything to the left of the decimal point could be the number of seconds from a starting date (example: 1/1/2000 at 12AM) and everything to the right could be the fractional second. That would prevent the situation of rollover occurring between the time your code checks the time and date (e.g., time checked at 23:59:59.995 and date checked 50ms later, after it rolled over).

    So one floating point number would contain the date and time to a resolution of milliseconds. Every other routine could work from that standard time representation. You could lose the DT_SecToDate, DT_SecToTime, etc. and just have DT_DateTimeFormat work with the numeric value to produce the string:

    [code=thinbasic]uses "DT"

    DIM RightNow as DOUBLE
    DIM Later as DOUBLE
    DIM TimeDateStr as STRING
    DIM DateOnlyFormat as STRING VALUE "mmm dd, yyyy"
    DIM TimeDateFormat as STRING VALUE (DateOnlyFormat & " " & TimeOnlyFormat)

    RightNow = DT_GetTimestamp ' Get the current time

    msgbox 0, DT_DateTimeFormat(RightNow, TimeDateFormat), "The current date and time"
    msgbox 0, DT_DateTimeFormat(RightNow + (2 * %week), DateOnlyFormat), "The date in two weeks"
    msgbox 0, DT_DateTimeFormat(RightNow + (15.5 * %minute), TimeOnlyFormat), "The time in 15.5 minutes"
    msgbox 0, DT_DateTimeFormat(RightNow + (%week + 3 * %day + 16 * %hour * 5 * %min + 26.122), TimeDateFormat), "The date and time in 1 week, 3 days, 16 hours, 5 minutes, and 26.122 seconds"
    [/code]

    I realize that it's a whole different way of handling the date and time, but I just wanted to pass the idea along. If it's just way too big a change, or if it's just not a good idea, I fully understand.

    Thanks.

    Regards,
    Fred

Page 2 of 2 FirstFirst 12

Similar Threads

  1. What are you working on?
    By Michael Clease in forum TBGL General
    Replies: 17
    Last Post: 02-02-2008, 07:11

Members who have read this thread: 0

There are no members to list at the moment.

Posting Permissions

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