Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Malnipulate datetime value

Status
Not open for further replies.

bertieuk

IS-IT--Management
Jun 1, 2004
175
Hi

I am collecting events from remote machines. I am able to connect and get the info.

I am having a problem converting the Datetime value returned by Timegenerated to another format.

The return value is meant to be datetime. An example of the returned value is:

20050329011309.000000+060
I want this converted to 29/03/2005 01:13.

Is there any good online resources for both date / time and string malnipulation?

Thanks

Si
 
can't you just split the string up?

strdate="20050329011309.000000+060"

dyears=left(strdate, 4)
strdate=mid(strdate, 5)

dmonths=left(strdate, 2)
strdate=mid(strdate, 3)

dday=left(strdate, 2)
strdate=mid(strdate, 3)

dhours=left(strdate, 2)
hours=mid(strdate, 3)

dminutes=left(strdate, 2)
strdate=mid(strdate, 3)

dseconds=left(strdate, 2)
strdate=mid(strdate, 3)

ddate=FormatDateTime(dday&"/"&dmonths&"/"&dyears&" "&dhours&":"&dminutes&":"&dseconds)

That should use it as a date time variable.
 
I have no idea what the .0000000+0.60 is at the end though........

;-)
 
This time is formatted in UTC (Coordinated Universal Time)
yyyymmddhhmmssZ
where Z stands for the time zone


Please tell me if I'm wrong I like to learn from my mistakes...
_____________________________________
Feed a man a fish and feed him for a day.
Teach a man to fish and feed him for a lifetime...
 
Thanks Guys

I have put the string malnipulation code into a function and all appears to be working.

When it comes to date in vbs, I always seem to have problems.

Si
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top