Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

ISO8601 date conversion functions needed.

Posted on 2001-08-26
5
Medium Priority
?
363 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
[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
  • 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 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))

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

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!

Question has a verified solution.

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

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…
Suggested Courses

604 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