How to change value of hours and seconds in the same date string?

I have a vba dateString variable in "longTime format" that is uncorrected for daylight saving,
I must adjust the hours value by -1, and then I need to adjust the seconds value by -1

Dim strDate As String
Dim dtDate As Date

The model of my string date:
      strDate = Format(Time, "Log Time")n
I can change the hour parameter in that date
      dtDate = DateAdd("h", -1, strDate)
or the second parameter
      dtDate = DateAdd("s", -1, strDate)

But how do I change BOTH parameters in the same date?
    ("s", -1, strDate) and ("h", -1, strDate)

Thanks
Kelvin
Kelvin4Asked:
Who is Participating?
 
Ryan ChongConnect With a Mentor Commented:
try this:
dtDate = DateAdd("h", -1, strDate)
    dtDate = DateAdd("s", -1, dtDate)

Open in new window

or
dtDate  = DateAdd("s", -1, DateAdd("h", -1, Format(Time, "Long Time")))

Open in new window

or
dtDate  = DateAdd("s", -1, DateAdd("h", -1, strDate))

Open in new window

0
 
Rgonzo1971Connect With a Mentor Commented:
Hi,

pls try

dtDate = DateAdd("s", -3601, strDate)

Open in new window

3600s = 1h

Regards
0
 
Kelvin4Author Commented:
Thanks to both. I should have used my head - twice!!
Kelvin
0
All Courses

From novice to tech pro — start learning today.