CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 Comparing Date Values

Print topic Send  topic

Author Message
SeanB
Posted: 03/24/2004, 1:28 PM

I am trying to compare date values on my task manager. I have a label for DueDate that I want to turn red when it is past due. I have a hidden label (Today) on my page with today's date as the default value.

The way I tried this is as follows:

Set DueDate as HTML (instead of Text)

Before Show
If Tasks.DueDate.Value < Tasks.Today.Value Then
Tasks.DueDate.Value = "<b><font color=""red"">" & Tasks.DueDate.Value & "</font></b>"
End If

This is not working. It shows the date fine, but does not change the color bold red if it is past due.

Can someone help me get this right?

Thanks,
Sean
DonB
Posted: 03/24/2004, 1:44 PM

You are comparing two strings, not two date values. Character sort-order
rules apply, not date arithmetic. I suggest that you modify the datasource
to include a virtual column that either contains a boolean or a date string
with embedded html to produce the color for overdue/not overdue (and mark
the label as containing"html" data if you use the second approach). If
neither of these is suitable, you can output the date like so: 2004-03-24.
Then you can compare the two strings.

--
DonB

http://www.gotodon.com/ccbth


"SeanB" <SeanB@forum.codecharge> wrote in message
news:64061fd8e35796@news.codecharge.com...
> I am trying to compare date values on my task manager. I have a label for
DueDate that I want to turn red when it is past due. I have a hidden label
(Today) on my page with today's date as the default value.
>
> The way I tried this is as follows:
>
> Set DueDate as HTML (instead of Text)
>
> Before Show
> If Tasks.DueDate.Value < Tasks.Today.Value Then
> Tasks.DueDate.Value = "<b><font color=""red"">" & Tasks.DueDate.Value &
"</font></b>"
> End If
>
> This is not working. It shows the date fine, but does not change the
color bold red if it is past due.
>
> Can someone help me get this right?
>
> Thanks,
> Sean
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Tony Do
Posted: 03/30/2004, 3:33 AM

Try the function cdate()
If (cdate(Tasks.DueDate.Value) < cdate(Tasks.Today.Value) ) Then
Tasks.DueDate.Value = "<b><font color=""red"">" & Tasks.DueDate.Value &
"</font></b>"
End If



"SeanB" <SeanB@forum.codecharge> wrote in message
news:64061fd8e35796@news.codecharge.com...
> I am trying to compare date values on my task manager. I have a label for
DueDate that I want to turn red when it is past due. I have a hidden label
(Today) on my page with today's date as the default value.
>
> The way I tried this is as follows:
>
> Set DueDate as HTML (instead of Text)
>
> Before Show
> If Tasks.DueDate.Value < Tasks.Today.Value Then
> Tasks.DueDate.Value = "<b><font color=""red"">" & Tasks.DueDate.Value &
"</font></b>"
> End If
>
> This is not working. It shows the date fine, but does not change the
color bold red if it is past due.
>
> Can someone help me get this right?
>
> Thanks,
> Sean
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.