We help IT Professionals succeed at work.
Get Started

C# Adjust DateTime based on Input Parameter

evci asked
Last Modified: 2016-02-11
Hi ... need your help with a DateTime issue.  I have a script that runs via a job scheduler. When the 'job' kicks off, it passes the appropriate DateTime (it is not always NOW.  The script runs 24 hours a day at the top of the hour.  Sometimes a job is delayed by 15 minutes to 45 minutes, but will always use the top of the hour time).

The DateTime are passed automatically to my script via @@startDateTime@@ and @@endDateTime@@.  The format of these two parameters are "yyyy-MM-dd 00:00".

     @@startDateTime@@ = "2016-02-10 10:00"
    @@endDateTime@@ = "2016-02-10 10:59"

I need to return newStartDateTime = "2016-02-10 09:00" and newEndDateTime = "2016-02-10 09:59"
Watch Question
Distinguished Expert 2019
This problem has been solved!
Unlock 1 Answer and 5 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE