Solved

How to Convert String Date & Time parameters into DATE type

Posted on 2001-06-26
7
984 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 2
7 Comments
 
LVL 12

Accepted Solution

by:
migel earned 100 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone 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

Suggested Solutions

Title # Comments Views Activity
has22 challenge 11 107
Window placement 17 95
wordcount challenge 11 147
Bartender label printing - switch on and off graphics 3 76
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: The undo support, implementing a stack. Continuing from the eigth article about sudoku.   We need a mechanism to keep track of the digits entered so as to implement an undo mechanism.  This should be a ‘Last In First Out’ collec…
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.

726 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