PC Review


Reply
Thread Tools Rate Thread

What is the differance between cdate and ...

 
 
Bruccce
Guest
Posts: n/a
 
      7th Aug 2003
I had this in my code
ActiveCell.Offset(0, 8) = CDate(TextBox_Attempt1Date)
and I wanted to include the time as well and changed it to
ActiveCell.Offset(0, 8) = TextBox_Attempt1Date

Now when i evaluate the cell<today() , I am always getting true, even if the
value from yesterday is in the cell.

How should I code this so that I get the date and time, but also so that the
comparison with today() provides valid results?

Thnaks
Bruce


 
Reply With Quote
 
 
 
 
Tom Ogilvy
Guest
Posts: n/a
 
      7th Aug 2003
No reason not to use cdate:

? typename(cdate("01/01/2003 10:53 AM"))
Date
? cdate("01/01/2003 10:53 AM")
1/1/2003 10:53:00 AM


Regards,
Tom Ogilvy

"Bruccce" <(E-Mail Removed)> wrote in message
news:NOvYa.88848$uu5.12702@sccrnsc04...
> I had this in my code
> ActiveCell.Offset(0, 8) = CDate(TextBox_Attempt1Date)
> and I wanted to include the time as well and changed it to
> ActiveCell.Offset(0, 8) = TextBox_Attempt1Date
>
> Now when i evaluate the cell<today() , I am always getting true, even if

the
> value from yesterday is in the cell.
>
> How should I code this so that I get the date and time, but also so that

the
> comparison with today() provides valid results?
>
> Thnaks
> Bruce
>
>



 
Reply With Quote
 
Bruccce
Guest
Posts: n/a
 
      7th Aug 2003
When I use cdate(TextBox_Attempt1Date) is only has the date, not the time.
where TextBox_Attempt1Date has the date AND time. Is there a setting that
controls cDate()?

Bruce

"Tom Ogilvy" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> No reason not to use cdate:
>
> ? typename(cdate("01/01/2003 10:53 AM"))
> Date
> ? cdate("01/01/2003 10:53 AM")
> 1/1/2003 10:53:00 AM
>
>
> Regards,
> Tom Ogilvy
>
> "Bruccce" <(E-Mail Removed)> wrote in message
> news:NOvYa.88848$uu5.12702@sccrnsc04...
> > I had this in my code
> > ActiveCell.Offset(0, 8) = CDate(TextBox_Attempt1Date)
> > and I wanted to include the time as well and changed it to
> > ActiveCell.Offset(0, 8) = TextBox_Attempt1Date
> >
> > Now when i evaluate the cell<today() , I am always getting true, even if

> the
> > value from yesterday is in the cell.
> >
> > How should I code this so that I get the date and time, but also so that

> the
> > comparison with today() provides valid results?
> >
> > Thnaks
> > Bruce
> >
> >

>
>



 
Reply With Quote
 
Tom Ogilvy
Guest
Posts: n/a
 
      7th Aug 2003
As I demonstrated, it has the time as well if the text string has the time.
I suspect you need to format the cell to show the time.

Today at noon would look like

? cdbl(cdate(date+timevalue("12:00")))
37840.5

If I put this in a cell

Range("B9").Value = cdate(date+timevalue("12:00"))
? range("B9").Text
8/7/2003 12:00
' but if I format the cell to just show date
Range("B9").NumberFormat = "mm/dd/yyyy"
? range("B9").Text
08/07/2003
' however, the time is still stored in the cell
? range("B9").Value
8/7/2003 12:00:00 PM

I suspect you are seeing formatted output and not look at what is actually
stored in the cell.

Regards,
Tom Ogilvy


"Bruccce" <(E-Mail Removed)> wrote in message
news:R1xYa.90594$YN5.64744@sccrnsc01...
> When I use cdate(TextBox_Attempt1Date) is only has the date, not the time.
> where TextBox_Attempt1Date has the date AND time. Is there a setting that
> controls cDate()?
>
> Bruce
>
> "Tom Ogilvy" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
> > No reason not to use cdate:
> >
> > ? typename(cdate("01/01/2003 10:53 AM"))
> > Date
> > ? cdate("01/01/2003 10:53 AM")
> > 1/1/2003 10:53:00 AM
> >
> >
> > Regards,
> > Tom Ogilvy
> >
> > "Bruccce" <(E-Mail Removed)> wrote in message
> > news:NOvYa.88848$uu5.12702@sccrnsc04...
> > > I had this in my code
> > > ActiveCell.Offset(0, 8) = CDate(TextBox_Attempt1Date)
> > > and I wanted to include the time as well and changed it to
> > > ActiveCell.Offset(0, 8) = TextBox_Attempt1Date
> > >
> > > Now when i evaluate the cell<today() , I am always getting true, even

if
> > the
> > > value from yesterday is in the cell.
> > >
> > > How should I code this so that I get the date and time, but also so

that
> > the
> > > comparison with today() provides valid results?
> > >
> > > Thnaks
> > > Bruce
> > >
> > >

> >
> >

>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
what a differance D. Windows XP General 11 1st May 2008 08:29 PM
whats the differance? =?Utf-8?B?dmFuZXNzYWNhYnJlcmEz?= Microsoft Word Document Management 8 21st Aug 2006 05:42 AM
Differance between CD and DVD for video? Daryl Helwig Storage Devices 5 9th Feb 2004 08:12 AM
Differance between vcd and svcd Kris Windows XP Video 2 26th Nov 2003 06:12 PM
xp pro or home any differance craig fitz Windows XP Print / Fax 1 17th Sep 2003 08:51 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:50 AM.