?
Solved

How to Convert String Date & Time parameters into DATE type

Posted on 2001-06-26
7
Medium Priority
?
1,018 Views
Last Modified: 2013-11-20
I have a string value that represents a date in the format "dd/mm/yy", and a time value representing the time in the format "hh:mm".  What I need to do is combine and convert them into a DATE value.

I've looked at the VarDateFromStr() function, and it seems to do the job, but I need to know what the date and time string for the first parameter (strIn) will look like.

Any examples would be much appreciated.
0
Comment
Question by:carlpaddick
  • 5
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
migel earned 300 total points
ID: 6227326
hi!
look at MSDN:
PRB: VarDateFromStr Does Not Consider Date Formats for Specific Locales
ID: Q241893      

"...
The function returns without error if the passed string is valid in any of the following date formats:
DD-MM-YYYY

MM-DD-YYYY

YYYY-MM-DD

..."
0
 

Author Comment

by:carlpaddick
ID: 6227354
Can you give me the URL for this migel?  Also does it illustrate the combining of the date and times for they are passed to VarDateFromStr?
0
 
LVL 12

Expert Comment

by:migel
ID: 6227403
here is link:
http://support.microsoft.com/support/kb/articles/Q241/8/93.ASP
time can be parsed when you specify
VAR_TIMEVALUEONLY
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 

Author Comment

by:carlpaddick
ID: 6227435
Thanks.
0
 

Author Comment

by:carlpaddick
ID: 6230596
migel,

Can you (or anyone else) tell me how you set the time value for the VarDateFromStr function?

It seems that one can use the hyphen character to separate the date value, such as:

27-06-01 or 06-26-01

Does anyone know if the time value's hours and minutes parameters must be separated by a colon(:), such as:

07:30 or 18:45

or another character?
0
 

Author Comment

by:carlpaddick
ID: 6237720
Don't worry about the last comment/question - sorted it myself.

Carl
0
 

Author Comment

by:carlpaddick
ID: 6237729
With your helpful MSDN document migel and a bit of experimenting myself, I have sorted out my problem.  You were the only person to contribute towards this question, so the points are yours.

Thanks for your help and keep up the good work,

Carl
0

Featured Post

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Load and Save to file, Document-View interaction inside the SDI. Continuing from the second article about sudoku.   Open the project in visual studio. From the class view select CSudokuDoc and double click to open the header …
Introduction: Finishing the grid – keyboard support for arrow keys to manoeuvre, entering the numbers.  The PreTranslateMessage function is to be used to intercept and respond to keyboard events. Continuing from the fourth article about sudoku. …
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

850 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question