[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Adjust time of datetime

Posted on 2012-12-24
2
Medium Priority
?
298 Views
Last Modified: 2012-12-24
Hello all,

I'm running a report at X time every Y hours.  Each time the report runs my vb.net windows form application calculates the next run time and stores that datetime.  I anticipated some drift of time where the report will get progressively later in the day so I kept the original "base time" as a field in the database for this record.  I'm trying to figure out a way to measure if the next run time is more than a minute past the "base time" and if so force the next run time back to the base time.  Aircode:

If nextRunTIme(hh:mm) - BaseTime(hh:mm) > 1 then
       NetRunTime = correct NextRunTime Date but BaseTime Hours:Minutes
End If

In other words:

If NextRunTime (12/24/2012 9:05 PM) - BaseTIme(9/12/2012 9:00 PM) > 1 Then
        NextRunTime = 12/24/2012 9:00 PM
End If

Take the date from NextRunTime but the TIME from BaseTime?

Thanks
0
Comment
Question by:zipnotic
[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
2 Comments
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 820 total points
ID: 38719532
Try:

If (nextRunTime.TimeOfDay - baseTime.TimeOfDay).TotalMinutes > 1 Then
    nextRunTime = nextRunTime.Date.Add(baseTime.TimeOfDay)
End If

Open in new window

0
 

Author Closing Comment

by:zipnotic
ID: 38719535
Perfect! You made it easy
Thank You
0

Featured Post

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

Question has a verified solution.

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

This document covers how to connect to SQL Server and browse its contents.  It is meant for those new to Visual Studio and/or working with Microsoft SQL Server.  It is not a guide to building SQL Server database connections in your code.  This is mo…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

656 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