YetAnotherForum
Welcome Guest Search | Active Topics | Log In | Register

Dealing with Dates Options · View
erburrell
#1 Posted : Tuesday, May 26, 2009 4:29:48 PM
Rank: Member
Groups: Member

Joined: 4/2/2009
Posts: 19
Location: Mississippi, USA
All,

I am writing code to do a search within PI for a particular event. In my case, it is the start of a unit. I am looking for code to basically deal with the date in VB.NET. How can I increment the date by some number (this is modified as I zero in on the event)? I am passing the date to my PI calls as a string in the format mm/dd/yyyy hh:mm:ss and have tried some code to convert this to a double format, and then back to a string once the number is incremented, but I am thinking there has to be a better way. If anyone has any ideas how to handle this, I would greatly appreciate it.

Ray
Sponsor  
 

OSIsoft vCampus is a subscription-based, online offering that consists of providing everything people need to develop applications on the PI System.
We invite you to take a "tour" of the OSIsoft Virtual Campus - also feel free to consult the FAQ  or contact OSIsoft vCampus for more details.
RJK Solutions
#2 Posted : Wednesday, May 27, 2009 1:24:37 PM
Rank: Administration

Groups: Administration

Joined: 6/20/2008
Posts: 612
Location: Cheshire, United Kingdom.
Hi Ray,

There sure is much easier way in .Net to deal with dates - we are talking general dates rather than PI absolute/relative dates.

.Net presents the Datetime object of which there are some handy methods... object.AddMinutes, object.AddSeconds etc. Lookup DateTime object and go from there...

Example:

Dim DT as DateTime = Datetime.Now.AddSeconds(-30) 'Time 30 seconds ago

Dim DT as DateTime = Datetime.Now.AddSeconds(30) 'Time 30 seconds in the future.


Rhys.
Principal Consultant
Real-Time Data Management @ Wipro Technologies
Users browsing this topic
Guest
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.