Stripping the time from a date value 
Author Message
 Stripping the time from a date value

Is there a function that will strip the time from a date value, i.e. make
the time the midnight of the relevant date? My ideas for this fall foul of
different date formats, e.g. 31/12/02 UK = 12/31/02 US

If there isn't a function can somebody suggest a more robust method of
achieving this?

Thanks



Fri, 15 Oct 2004 00:15:10 GMT  
 Stripping the time from a date value
On Sun, 28 Apr 2002 17:15:10 +0100, "Geoff Soper"

Quote:

>Is there a function that will strip the time from a date value, i.e. make
>the time the midnight of the relevant date? My ideas for this fall foul of
>different date formats, e.g. 31/12/02 UK = 12/31/02 US

>If there isn't a function can somebody suggest a more robust method of
>achieving this?

msgbox( Format$(myDate, "short date"))
or "medium date" or "long date"
or "dd\mm\yyyy"

or is this what you want ?

    Dim d As Date
    d = Now
    d = d - CDate(Format(d, "hh:mm:ss"))
    MsgBox (d)

or... i don't know, you think of something !  ;-)

Regards, Frank



Fri, 15 Oct 2004 00:38:19 GMT  
 Stripping the time from a date value
Thanks, that latter one was just right!


Quote:
> On Sun, 28 Apr 2002 17:15:10 +0100, "Geoff Soper"

> >Is there a function that will strip the time from a date value, i.e. make
> >the time the midnight of the relevant date? My ideas for this fall foul
of
> >different date formats, e.g. 31/12/02 UK = 12/31/02 US

> >If there isn't a function can somebody suggest a more robust method of
> >achieving this?

> msgbox( Format$(myDate, "short date"))
> or "medium date" or "long date"
> or "dd\mm\yyyy"

> or is this what you want ?

>     Dim d As Date
>     d = Now
>     d = d - CDate(Format(d, "hh:mm:ss"))
>     MsgBox (d)

> or... i don't know, you think of something !  ;-)

> Regards, Frank



Sun, 31 Oct 2004 05:35:50 GMT  
 Stripping the time from a date value
Or how about . . .

d = Int (d)


Quote:
> Thanks, that latter one was just right!



> > On Sun, 28 Apr 2002 17:15:10 +0100, "Geoff Soper"

> > >Is there a function that will strip the time from a date value, i.e.
make
> > >the time the midnight of the relevant date? My ideas for this fall foul
> of
> > >different date formats, e.g. 31/12/02 UK = 12/31/02 US

> > >If there isn't a function can somebody suggest a more robust method of
> > >achieving this?

> > msgbox( Format$(myDate, "short date"))
> > or "medium date" or "long date"
> > or "dd\mm\yyyy"

> > or is this what you want ?

> >     Dim d As Date
> >     d = Now
> >     d = d - CDate(Format(d, "hh:mm:ss"))
> >     MsgBox (d)

> > or... i don't know, you think of something !  ;-)

> > Regards, Frank



Sun, 31 Oct 2004 14:58:18 GMT  
 Stripping the time from a date value
On Wed, 15 May 2002 07:58:18 +0100, "Mike Williams"

Quote:

>Or how about . . .

>d = Int (d)

That's good  Mike. Took your damn time though. ;-)  

Regards, Frank



Sun, 31 Oct 2004 17:53:11 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. combining a time and a date to one Date/Time value

2. Null date values in Date/Time fields in Access DB

3. how to set a date time value different from system time in the status bar

4. Compare date in form with date/time in form with date/time in database

5. Matching system date/time with field date/time

6. start date/time, end date/time problem

7. How to subtract a date-time from a date-time

8. ADO with Access Date/Time field not storing the time, just the date

9. Converting %date% %time% to VB Time/Date

10. compare date/time values

11. Passing a date/time value to a property using VBScript

12. Date time value getting truncated in the DataGrid??....

 

 
Powered by phpBB® Forum Software