Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations John Tel on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DateTime - drop or zero out Time 1

Status
Not open for further replies.

Hueby

MIS
Oct 20, 2004
321
US
Hey all, I have done a couple of searches, but haven't found an clear answer....... I am wanting to drop or SET the time values to 00:00:00 .... how do I do this?

Code:
  Format(CDate(var1), "MM/dd/yyyy hh:mm:ss")
        Format(CDate(var2), "MM/dd/yyyy hh:mm:ss")
 
Well acutally both of those methods didn't work......

I think I found out that this works though:

Code:
var1 = Format((var1), "MM/dd/yyyy")
 
I can't see the difference between what rick said and what you say. is var1 a date variable by any chance???

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
The only difference is not using the CDate code, and just using Format. var1 is a date variable yes...
 
then that's why you didn't need the cdate. because cdate goes from string to date and to format in the date format you need to feed the format function a date. So ricks methods worked (and he deserves a star for that) you just gave him the wrong information. and he was confused because you already used cdate in your question.

If you want a good answer give a good question.

Thank you.

Christiaan Baes
Belgium

If you want to get an answer read this FAQ faq796-2540
There's no such thing as a winnable war - Sting
 
Ohhhhhhh.. well that explains a lot then, I didn't even think of the variable coming into play as it did.

You did not have to be so rude about it either.

Thank you.
 
What's wrong with the shared MinValue property of the DateTime class?

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
12am is 00:00:00

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Console.WriteLine(DateTime.MinValue.ToString("d", CultureInfo.InvariantCulture) will return 0001/01/01 00:00:00.00000

Is this not what the OP was wanting?

Chip H.


____________________________________________________________________
If you want to get the best response to a question, please read FAQ222-2244 first
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top