Can I convert a TODAY() value into a string

R

Ray Stevens

I have a datasource where the SQL Server data type for a date column is
varchar(10) (i.e. yyyy-mm-dd). I need to compare this to today's date ( ex.
=today()>$f2, where $f2 is the varchar(10) date field returned from SQL
Server ) but am not sure of how to do it. Should I convert today() to a text
field?
 
P

Pete_UK

Try this:

=IF(TEXT(today(),"yyyy-mm-dd")>$F2, is_true, is_false)

where "is_true" is the formula you want if the condition is true and
"is_false" follows the same logic.

Hope this helps.

Pete
 
B

Bob Phillips

If you want it in VBA, try

dates_string = "#" & format(Date, "dd/mm/yyyy#")

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)
 
Top