Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here


String to date value

String to date value

String to date value

Hi, i have this query in ASP code and it's works ok

SELECTSQL = "SELECT * FROM M_DOCCLI where cdg_tdoc='002' and cdg_tmov<>'998' and fec_docu=(SELECT CURRENT DATE AS FEC FROM SYSIBM.SYSDUMMY1)"

but the problem is when i try to use a variable
I have a textbox with string value '20/03/2008' and this string value is assigned to FDESDE and it doesn't work

SELECTSQL = "SELECT * FROM M_DOCCLI where cdg_tdoc='002' and cdg_tmov<>'998' and fec_docu>= '"& FDESDE &"'"

How convert string value FDESDE to date with format dd/MM/yyyy?

Im working with IBM DB2 v6.0 and when i execute "values current date" command i get this expresion 10/07/2009

Thanks a lot


RE: String to date value

I think that this is more of an issue with the ASP language rather than DB2, as the troulbe that you appear to be having is assigning the SELECTSQL variable with the correct value, but I may have misunderstood.

What error is being returned? And when are you seeing this error?


RE: String to date value

Having thought about this a little more, it could also be that DB2 is not recognising the variable as a date format. You said that when you execute values current date, it comes back with the format dd/mm/yyyy, but that may (or may not) be ASP interpreting it.

Try CCYY-MM-DD or if that doesn't work, try putting the word DATE around it so that your code reads:


SELECTSQL = "SELECT * FROM M_DOCCLI where cdg_tdoc='002' and cdg_tmov<>'998' and fec_docu>= DATE('" & FDESDE & "')"

Let us know how you get on - hope this helps.


Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close