VB icon

Date Style

Email
Submitted on: 2/6/2017 12:07:49 PM
By: Crock 
Level: Beginner
User Rating: Unrated
Compatibility: VB 5.0, VB 6.0, VB Script, VBA MS Access, VBA MS Excel
Views: 5510
 
     Although the "Date data type" is locale aware. Knowing the regional date format can be useful. For example showing the format in a label. DateStyleUSA is a simple function to determine if the regional date format is mm/dd/yyyy. I may be re-inventing the wheel but have not found a similar function without resorting to API's.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
				
'**************************************
' Name: Date Style
' Description:Although the "Date data type" is locale aware. Knowing the regional date format can be useful. For example showing the format in a label. DateStyleUSA is a simple function to determine if the regional date format is mm/dd/yyyy. I may be re-inventing the wheel but have not found a similar function without resorting to API's. 
' By: Crock
'**************************************

Public Function DateStyleUSA() As Boolean ' Regional date styles. USA mm/dd/yyyy, UK dd/mm/yyyy
 
 Dim sDate As String
 
 sDate = "01/02/2000" ' The ambiguity is intended, don't use a date literal.
 
 ' The day function returns 1(uk) or 2(usa).
 DateStyleUSA = Day(sDate) <> 1
 
End Function


Other 10 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Beginner category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

3/12/2017 4:25:28 PMhai2hai

Oh, that's very simple method. Thanks!
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.