Solved

How to Convert String Date & Time parameters into DATE type

Posted on 2001-06-26
7
959 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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

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

Top 6 Sources for Identifying Threat Actor TTPs

Understanding your enemy is essential. These six sources will help you identify the most popular threat actor tactics, techniques, and procedures (TTPs).

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Running shell command from Access 3 63
Host to IP 7 73
Named range not carried over 10 57
Detect file exist or not 3 83
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…
Introduction: Dialogs (2) modeless dialog and a worker thread.  Handling data shared between threads.  Recursive functions. Continuing from the tenth article about sudoku.   Last article we worked with a modal dialog to help maintain informat…
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.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

747 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now