Date format question

rfresh

Well-Known Member
Licensed User
Longtime User
I looked at the DateTime docs but I don't understand how to use the DateFormat to show the year as '12' vs '2012'? 04/18/12 vs 04/18/2012.

Thanks for any help...
 

rfresh

Well-Known Member
Licensed User
Longtime User
How do I use that? I'm using this now:

B4X:
Dim date, time As Long
date = DateTime.Now
DateTime.date(date)

So how would I use that date format mask?

And are there docs on how to format time? I want to use am/pm format for my times.

B4X:
DateTime.time(date)
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
This is the way I format time the way you want it:
B4X:
DateTime.TimeFormat="h:mm:ss a"   
DateTime.Time(now)
' example: 6:35:19 PM
 
Upvote 0

rfresh

Well-Known Member
Licensed User
Longtime User
It should be like:

B4X:
'Sample from Wiki
Dim now as Long
Dim dt as String
now = DateTime.Now
DateTime.DateFormat = "MM/dd/yy"
dt = DateTime.Date(now)
Msgbox(dt, "MM/dd/yy")

May I get that Wiki URL reference please? Thanks...
 
Upvote 0
Top