Solved

ISO8601 date conversion functions needed.

Posted on 2001-08-26
5
340 Views
Last Modified: 2008-02-01
Hello.
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.
Sincerely,
Crin
0
Comment
Question by:Crin
  • 3
5 Comments
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6426424
Format$(now,"yyyymmdd-hh:nn:ss")

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

Anthony

0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 6426440
Actually the correct format is as follows:
YYYY-MM-DDTHH:MM:SS

Here is the link to the official site
http://www.w3.org/TR/NOTE-datetime

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

Format$(now,"yyyy-mm-ddThh:nn:ss")
0
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 75 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))

Cheers
0
 
LVL 75

Expert Comment

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

Anthony
0
 
LVL 2

Author Comment

by:Crin
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.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say 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 While answering a recent question about filtering a custom class collection, I realized that this could be accomplished with very little code by using the ScriptControl (SC) library.  This article will introduce you to the SC library a…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…

808 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