ISO8601 date conversion functions needed.

Posted on 2001-08-26
Medium Priority
Last Modified: 2008-02-01
I have urgent tasks and have no time for subj.
Will grant points for VB code (or link) converting dates from ISO8601 format (YYYYMMDD-HH:MM:SS) to Date. CDate function usage prohibited.
Question by:Crin
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
  • 3
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6426424

By the way ISO8601 requires a T between the date and time.


LVL 75

Expert Comment

by:Anthony Perkins
ID: 6426440
Actually the correct format is as follows:

Here is the link to the official site

In any case, it is pretty easy to change your code:

LVL 143

Accepted Solution

Guy Hengel [angelIII / a3] earned 300 total points
ID: 6426519
I think you need the dateserial function, somewhat like this:

dim yourdate as Date
dim strInput as string

strInput = "20010502-19:48:10"

yourdate = DateSerial ( left(strInput,4), mid(strInput, 5,2), mid(strInput, 7,2)) + TimeSerial ( mid(strInput,10,2),mid(strInput,13,2),mid(strInput,16,2))

LVL 75

Expert Comment

by:Anthony Perkins
ID: 6426579
angelIII is right I misread the question.


Author Comment

ID: 6426651
Thanks, 'DateSerial' name of the function would be enough...

Hehe... Looks so interesting, after 14 yrs of programming I was stalled with simpliest task! I defenitely need vacation! :))

Thanks a lot!

PS. (For those who might read it in the future) By the way, ISO8601 format in fact specify letter 'T' between date and time, I replaced it with minus sign to simplify the string appearance. However, answer provided is absolutely right.

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month10 days, 22 hours left to enroll

770 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