IF its a date display "X" if not "Y"

I have two fields in my database and a trigger. If a user enters a date it will copy from:

ExpiresOn  to ExpiresonD

If its not a date then it won't copy it to ExpiresonD and it remains blank

Now .. when displaying the data I want to have an IF ...

If ExpiresonD is blank then display:

<%= ContactDetails.Fields.Item("ExpiresOn") %>

If its not blank then display:

<%= DoDateTime((ContactDetails.Fields.Item("ExpiresOn").Value), 2, 9225) %>

I am using ASP/VB classic
LVL 1
AleksAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Scott Fell, EE MVEDeveloper & EE ModeratorCommented:
I'm guessing this... let me know if it works for you or not.

dim ExpiresOn, ExpiresonD

ExpiresOn=request.form("someField")
' check if we have a date
if ExpiresOn<> then
      if isdate(ExpiresOn) then
          ExpiresonD=ExpiresOn ' good date, use it
      end if
end if

If ExpiresonD ="" then

     response.write ContactDetails.Fields.Item("ExpiresOn") 

     else 'If its not blank then display:

     response.write DoDateTime((ContactDetails.Fields.Item("ExpiresOn").Value), 2, 9225)

end if 

Open in new window

0
Julian HansenCommented:
Just as a matter of interest have you tried

if ExpiresonD == '' Then
<%= ContactDetails.Fields.Item("ExpiresOn") %>
else
<%= DoDateTime((ContactDetails.Fields.Item("ExpiresOn").Value), 2, 9225) %>
end if

Open in new window

0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
AleksAuthor Commented:
THx !
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.