-
Mar 2nd, 2021, 04:58 AM
#1
Thread Starter
Junior Member
Datetime
How i display the time by day/month/year?
thanks in advance.
-
Mar 2nd, 2021, 05:10 AM
#2
Thread Starter
Junior Member
Re: Datetime
i have used Date(), but it set date with slahes how i set it like this dd-mm-yyyy?
-
Mar 2nd, 2021, 05:32 AM
#3
-
Mar 2nd, 2021, 09:36 PM
#4
Re: Datetime
Originally Posted by hamon
i have used Date(), but it set date with slahes how i set it like this dd-mm-yyyy?
Show your code, and I will tweak it
-
Mar 3rd, 2021, 01:15 AM
#5
Re: Datetime
Originally Posted by hamon
i have used Date(), but it set date with slahes
No, it doesn't. Date type data is not a String, it's a date and time represented as a double precision real number (float) basically identical internally to VB's Double type. There are no bits of text with punctuation.
We'd have to see what you are doing with Date typed data. I'd guess something like relying on implicit coercion to convert it to String.
-
Mar 3rd, 2021, 06:25 AM
#6
Re: Datetime
Originally Posted by hamon
i have used Date(), but it set date with slashes ...
Here's a slightly unexpected, Unwritten Rule about Dates:
Dates have no format.
(None any that you or I need to worry about, anyway).
If you think they do, then you're almost always working with a String, not a Date.
Originally Posted by hamon
... how i set it like this dd-mm-yyyy?
With the Format$() function.
Code:
Dim dtNow as Date
Dim sNow as String
dtNow = Date()
sNow = Format$( dtNow, "dd-mm-yyyy" )
Code:
Debug.Print sNow
03-03-2021
Debug.Print dtNow
2021.03.02 <-- your machine's local date format (locale).
Regards,
Phill W.
-
Mar 3rd, 2021, 07:12 AM
#7
Thread Starter
Junior Member
Re: Datetime
Already done anyway thank you Phill W.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|