I am trying to check if current datetime is between current date plus 06:00:00 and 20:00:00 (in turkish culture)
I want date to be populated as "dd.mm.yyyy hh:mm:ss"... How would I do this in vb.net?
Dim sDate as String = TodayIs.ToShortDateString + " 06:00:00"
Dim eDate as String = TodayIs.ToShortDateString + " 20:00:00"
if time >= sDate and time <= eDate then
Ever thought of changing the culture before formatting the Date?
Don't go out to strings. If you are looking to see if something is between 6am and 8pm then:
Dim today as DateTime.Now
Dim sixAm as today.Date.AddHours(6)
Dim eightPm as today.Date.AddHours(20)
Then you can check if something is between those two dates. Strings are not your friends.
Can you show me the code for the culture change you made?
This topic is now archived. It is frozen and cannot be changed in any way.