Format Issue

Hello,

I am trying to format Today’s date to use it in a Select statement. I know there are some records in AS400 table but I am not getting any.

I need to pull all documents that were created yesterday. AS400 date format is yyyymmdd.

Dim dt As New NotesDateTime(Today)

dt2 = Format((dt.LSLocalTime)-1,“yyyymmdd”)

Qry.SQL = “Select * FROM SAABA.ABCD WHERE G9CRTD = dt2”

It says zero records found.

Please help.

Thank you

Subject: Format Issue

Vadim, it depends on how the dates are stored in your DB2 table. If it’s stored as text what I have below will work. If it is a date/time column you will need to replace the single quotes with the DB2 escape character for dates, which I don’t know.

– Charles

Dim dt As New NotesDateTime(Today)

Dim dt2 As String

Call dt.AdjustDay(-1)

dt2 = Format$(dt.LocalTime, “yyyymmdd”)

qry.SQL = “SELECT * FROM SAABA.ABCD WHERE G9CRTD = '” & dt2 & “'”