How to convert dates

T

Tony Girgenti

I have a form that accepts a start date and end date in the short date
format(6/19/1994). When i watch it after it is entered, it looks exactly
like the way it is keyed in with slashes and all.
I want to compare it to a field text field in an external data table which
has it's dates stored as yyyymmdd. I wrote a routine to change the entered
date to remove the slashes and format it the same way as the date in the
table.

Is there a better way to do that ? Is there a function that will convert an
entered short date to the yyyymmdd format ?

Any help appreciated.

Thanks,
Tony
 
B

Bruce M. Thompson

I have a form that accepts a start date and end date in the short date
format(6/19/1994). When i watch it after it is entered, it looks exactly
like the way it is keyed in with slashes and all.
I want to compare it to a field text field in an external data table which
has it's dates stored as yyyymmdd. I wrote a routine to change the entered
date to remove the slashes and format it the same way as the date in the
table.

Is there a better way to do that ? Is there a function that will convert an
entered short date to the yyyymmdd format ?

From the immediate (debug) window:

? format$(date(),"yyyymmdd") = "20030927"
True

Is this what you're looking for?
 
T

Tony Girgenti

That's great Bruce. I really appreciate your help.

That saved me about ten lines of coding for each date and i learned
something.

Tony
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top