INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Date minipulation

Date minipulation

(OP)
Having trouble figuring this one out. I know it can't be too hard but I don't think I've had enough coffee yet this morning.

My problem is, I have a date field [StartDate] in the format "7/31/2016 9:26:12 PM". If that date is a Sunday (which is easy to determine), I need to make that date the following morning at 7am or "8/1/2016 7:00:00 AM". I can't figure out how to programatically change the date.

Any ideas?

Any help and assistance is greatly appreciated.

flush

Michael

It is said that God will give you no more than you can handle. I just wish God didn't think I was just a bad ass.

RE: Date minipulation

Hi,

Assuming that [StartDate] is a real date...

CODE

NextDay = DateSerial(Year([StartDate]), Month([StartDate]), Day([StartDate])+1) + TimeSerial(7,0,0) 

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

RE: Date minipulation

(OP)
Thanks a ton Skip.

flush

Michael

It is said that God will give you no more than you can handle. I just wish God didn't think I was just a bad ass.

RE: Date minipulation

Skip's example adds a day to the value of [StartDate] no matter what day of the week it is. Use the WeekDay function with vbSunday to determine if it is Sunday and then run his code if it is.

RE: Date minipulation

Hmmmmmmm????

"I have a date field [StartDate] in the format "7/31/2016 9:26:12 PM"
"I need to make that date the following morning at 7am"

Turns out, the date that the OP has is a Sunday.

Straining at a gnat?

Skip,

glassesJust traded in my OLD subtlety...
for a NUance!tongue

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close