Go Back   Access World Forums > Microsoft Access Discussion > Queries

 
Reply
 
Thread Tools Rate Thread Display Modes
Old 08-16-2019, 01:10 PM   #16
Mark_
Longboard on the internet
 
Join Date: Sep 2017
Location: Not the middle of no where, but I can see the road to it from my house.
Posts: 2,002
Thanks: 20
Thanked 376 Times in 369 Posts
Mark_ will become famous soon enough Mark_ will become famous soon enough
Re: Checking for date

One pattern that may need to be added, depending on who deals with governments, is

YYYYMMDD

Seeing 20190816 can really mess with you if you don't know its supposed to be a date, but is also really handy for naming files to keep them in date order.

Mark_ is offline   Reply With Quote
Old 08-16-2019, 01:46 PM   #17
sxschech
Newly Registered User
 
Join Date: Mar 2010
Posts: 593
Thanks: 23
Thanked 111 Times in 100 Posts
sxschech is on a distinguished road
Re: Checking for date

Hi Mark,

That is already there under Pattern 8 and we do use that format for incorporation into some of our file names.

Code:
arrPattern(8) = "(19|20)[0-9]{2}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]){1,2}"               'yyyymmdd  must be 4 digit yr 2 digit mo 2 digit dt and no sep char
sxschech is offline   Reply With Quote
Old 08-16-2019, 03:59 PM   #18
NauticalGent
Pristine Curmudgeon
Gold Supporter
 
NauticalGent's Avatar
 
Join Date: Apr 2015
Location: Naples, Italy (EXPAT from Virginia)
Posts: 1,916
Thanks: 420
Thanked 277 Times in 243 Posts
NauticalGent has a spectacular aura about NauticalGent has a spectacular aura about
Re: Checking for date

@ArnelGP,

This is probably the best use of Regular Expressions I have seen to date. I appreciate you sharing and I am adding this one to the library.

Doubt if I will ever need this as it is written but it will serve as tutorial should I need to do something similar.

Thanks again!

__________________
- Ciao, John
NauticalGent is offline   Reply With Quote
Old 08-18-2019, 03:23 PM   #19
Mark_
Longboard on the internet
 
Join Date: Sep 2017
Location: Not the middle of no where, but I can see the road to it from my house.
Posts: 2,002
Thanks: 20
Thanked 376 Times in 369 Posts
Mark_ will become famous soon enough Mark_ will become famous soon enough
Re: Checking for date

Quote:
Originally Posted by sxschech View Post
Hi Mark,

That is already there under Pattern 8 and we do use that format for incorporation into some of our file names.

Code:
arrPattern(8) = "(19|20)[0-9]{2}(0[1-9]|1[012])(0[1-9]|[12][0-9]|3[01]){1,2}"               'yyyymmdd  must be 4 digit yr 2 digit mo 2 digit dt and no sep char
Missed this... Then again Arnel does have a fantastic piece of code that covers A LOT..
Mark_ is offline   Reply With Quote
Old 08-18-2019, 03:42 PM   #20
CJ_London
Super Moderator
 
Join Date: Feb 2013
Location: UK
Posts: 11,138
Thanks: 40
Thanked 3,613 Times in 3,488 Posts
CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light CJ_London is a glorious beacon of light
Re: Checking for date

Quote:
Or am I better off using my existing method where I have a single purpose function that I feed it the text and the pattern?
you could declare a public enum e.g.

Code:
Public Enum DateFormats
  shortdate = 1 
   ...
   ...
  MonthYear = 17
  etc
End Enum
then make the parameter optional - you then have the choice- leave it blank to run through all, or enter MonthYear or 17 as you wish

__________________
CJ_London
_______________________
A little thanks goes a long way. If you have found this post useful, please tick the thanks button
CJ_London is offline   Reply With Quote
Reply

Tags
checking for date

Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Checking date against a text box oMADMANo Visual Basic 0 01-25-2012 02:48 AM
Checking staff against booking date? bazzanoid Forms 9 10-22-2008 11:40 PM
Checking for date Tony1258 Modules & VBA 2 08-21-2006 07:51 AM
[SOLVED] Checking date availability rsmayze001 General 1 01-05-2006 12:38 PM
[SOLVED] Checking a previous date against present date Glyn Queries 2 05-04-2005 05:04 AM




All times are GMT -8. The time now is 11:37 PM.


Microsoft Access Help
General
Tables
Queries
Forms
Reports
Macros
Modules & VBA
Theory & Practice
Access FAQs
Code Repository
Sample Databases
Video Tutorials

Featured Forum post


Sponsored Links


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
(c) copyright 2017 Access World