Date Woes

K

Kevin Vaughn

I am trying to convert a date from this format:

yyyymmddHHMMSS.mmmmmmsUUU

to a format that ASP.NET (VB.NET) understands.

The above date format is used by the WMI datetime type. I don't care about
the mmmmmmsUUU part, as that counts milliseconds and microseconds. The sUUU
is a three digit offset indicating the number of minutes that the
originating time zone deviates from UTC. Other than that, the format is
pretty self explanatory.

(more info here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wmisdk/wmi/
date_and_time_format.asp)

I can imagine all kinds of weird, contorted, or otherwise convoluted ways of
formatting this date, but I wanted to check and see if there's an better way
before I go off and spend gobs of time reinventing the wheel.

Any ideas?

-Kevin
 
D

Daniel Bass

the easiest way i've seen would probably be:

Dim myDate as Date

myDate = yearstring & "/" & monthstring & "/" & daystring & " " & hourstring
& ":" & minstring

which means you'll have to split up the string somewhere into those
strings...

good luck
 
K

Kevin Vaughn

That's really exactly what I was looking for. Thank you for your time.

-Kevin
 
D

David Waz

Regular Expressions are GREAT for this kind of parsing...
Concise, easy to change and understand...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top