Solved

How to Convert String Date & Time parameters into DATE type

Posted on 2001-06-26
7
974 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 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
3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

 

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

ScreenConnect 6.0 Free Trial

Explore all the enhancements in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Folder Comparison 12 54
ASCII Non-Printable characters/codes and their HTML equivalents 6 117
Modbus - whats the maximum I can store in one register? 4 80
Not needed 13 113
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
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.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

809 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