compare date to a date

I have in a where clause the following statement.

  SELECT "sales"."sale_date",
    FROM "payment",
   WHERE ( "sales"."sales_id" = "payment"."sales_id" ) and
          "sales"."sale_date" = :a_date

sale_date is of type date and the retrieval arg is of type date.
But I keep getting the error that u can't convert to a timestamp.
There is no timestamp in the where clause or even in any columns..
So what the hell is wrong with this??????

11/4/2002 4:27:07 PM
sybase.powerbuilder.general 62418 articles. 18 followers. Follow

4 Replies

Similar Articles

[PageSpeed] 47

It depends on your rdbms. If it's Oracle, as you know, there's no "date"
datatype there, hence all the PB dates are supposed to be converted into
datetime or "timestamp" format. So just try to assign datetime type to your
retrieval argument.

"MJN" <> wrote in message
> I have in a where clause the following statement.
>   SELECT "sales"."sale_date",
>          "sales"."ling_no",
>          "sales"."course_no",
>          "sales"."product_no",
>          "sales"."service_no",
>          "sales"."quantity",
>          "sales"."amount",
>          "payment"."amount",
>          "payment"."payment_form"
>     FROM "payment",
>          "sales"
>    WHERE ( "sales"."sales_id" = "payment"."sales_id" ) and
>           "sales"."sale_date" = :a_date
> sale_date is of type date and the retrieval arg is of type date.
> But I keep getting the error that u can't convert to a timestamp.
> There is no timestamp in the where clause or even in any columns..
> So what the hell is wrong with this??????
> THanks

11/4/2002 4:33:11 PM
Another way to solve this is to use the SQL
DATEDIFF function:

select ... where DATEDIFF(days, column, :as_date) = 0

Provided of course that your RDBMS has one!

You may have to declare as_date as PB type datetime and then
set the time to 00:00:00 

as_date=datetime(date(today()), time('00:00:00'))

11/4/2002 5:23:52 PM
>>Another way to solve this is to use the SQL DATEDIFF function: 
select ... where DATEDIFF(days, column, :as_date) = 0

Provided of course that your RDBMS has one!

You may have to declare as_date as PB type datetime and then
set the time to 00:00:00 

as_date=datetime(date(today()), time('00:00:00'))


Or use other dbms date functions to convert the column and/or the argument 
to a common format (e.g. convert(char(8), @dateIn, 1) in Sybase ASE).

11/4/2002 9:31:44 PM
if you're using Oracle, use the trunc function to strip off any time component.

On Mon, 4 Nov 2002 12:23:52 -0500,
 in powersoft.public.powerbuilder.general
 <woz> wrote: 
>Another way to solve this is to use the SQL
>DATEDIFF function:
>select ... where DATEDIFF(days, column, :as_date) = 0
>Provided of course that your RDBMS has one!
>You may have to declare as_date as PB type datetime and then
>set the time to 00:00:00 
>as_date=datetime(date(today()), time('00:00:00'))
11/5/2002 5:10:33 PM

Similar Artilces:

Dates, Dates, Dates!
Hello all... I am in the process of building an appointment system, and I am trying to see if I can get some pointers on which way to go on this. The first version of this appointment system was very lo-tech, and it stored all of the possible dates/times in the database. Once a user booked an appointment, their information was logged to that date/time, and then that date/time would no longer show in the list of possible openings. This was great for a temporary fix, but with having to pre-populate all of the dates/times, the system would eventually have to be updated to continue on pa...

from date to date
I am working on a form for livestock. one of the things in the form is a checkbox to let me know if they qualify or not. the second is I have a created record field entered into the database... now my question is I am doing a search on this and cant figure it out since i am new to all this...i have a query that selects the qualification checkbox (where qualify = 'true') then another query that selects the created record date... and the search is that I want to get the information in the livestock that are qualifyed (have the checkbox qualify = to 'true') between  one dat...

From Date and To Date
 In my application i have two textboxes.One for From date and the other one for To date.I need to check whether the From date is lesser than To Date..Date formats will be either(DD-MM-YYYY) or (DD/MM/YYYY).and i have used calendar extender for selecting dateI need the script code to do this...Thanks in advance See this thread: Naeem"Please mark as answer if it helped you"  <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager> <div> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <cc1:CalendarExtender ID="TextBox1_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox1"> </cc1:CalendarExtender> <br /> <br /> <asp:TextBox ID="TextBox2" runat="server"></asp:TextBox> <cc1:CalendarExtender ID="TextBox2_CalendarExtender" runat="server" Enabled="True" TargetControlID="TextBox2"> </cc1:CalendarExtender> <asp:CompareValidator ID="CompareValidator1" runat="server" ControlToCompare="TextBox1" ControlToValidate="TextBox2&qu...

Comparing dates with today dates
I want to know if there is a way to compare dates in the sql statement with dates that I input into a database and todays date.  the datatype that I'm using is smalldatetime.The statement I used is:Select Date from Table where Date > ''I get an errorCould this be done or is there another approach? Select Date from Table where Date > getdate()If you just want to match dates and not times:Select Date from Table where convert(varchar(10), Date, 101) > convert(varchar(10), getDate(), 101)Nick...

Comparing dates with the dates in the database
I have dates that I am getting in my application in this format: "2/16/2009 11:00:00 PM". On my SQL Server, dates are stored like this: "2009-02-16 23:00:00.000". How can I compare these values? I specified the parameter for ObjectDataSource to be of DateTime type. This should mean that "2/16/2009 11:00:00 PM" gets converted to "2009-02-16 23:00:00.000", right? Now, my goal is to be able to compare dates so that I can list all pictures uploaded today, all pictures uploaded yesterday, etc. How would I go about doing this? How can I make a compar...

comparing date field with date
Dear sir, I am trying to get data from database using dataadapter. My querry string is string querystring="Select * from candidate where DateOfBirth > " +DateMin +""; DateMin is a dateTime variable carrying date value. DateOfBirth is the field name intable candidate. I have tried various versions for querystring. Each time error is thrown mostly syntex error. Kindly help me to form the querystring correctly.   Thanking in advance, pcg You should never, under no circumstances, pass SQL code on the query string. That's like leaving your house for vac...

Display date in PowerBuilder using regional settings date(Thai
Hi all, Need help on how to display date in PowerBuilder with an editmask following the date format in the regional settings. We have a client using buddhist calendar and should display the year as 2552 if 2009 is the year. Problem is, even if I use [date][time] edit mask, PB still displays the date as 25/02/2009 wherein it should be 25/02/2009. Thank you in advance, please help, its urgent. Willie This solution was posted to Experts Exchange by Vikas Dixit (so I cannot take credit) Although this was not specific for the Thai Calendar, it may provide the tools you need to ge...

Date.Compare won't compare dates with times??
Maybe I'm just on crack, but something doesn't seem right here. I'm trying to compare 2 timestamps and it doesn't seem to be working correctly. If I compare only dates without times it works as expected: MessageBox.Show(DateTime.Compare("3/5/04", "3/5/04")) ' returns 0 MessageBox.Show(DateTime.Compare("3/5/04", "3/6/04")) ' returns -1 MessageBox.Show(DateTime.Compare("3/5/04", "3/4/04")) ' returns 1 However, if I include times it doesn't seem to work correctly: MessageBox.Show(DateTime.Compare(CDate("3/5/04 ...

comparing Querystring date to database date
I have this in my QueryStringscheduler2.aspx?showSched=8/20/2007and in SQL I have a field named bookedDate that is shortdatetime and holds the date 8/20/2007how can I compare these? I'm trying this:Me.lblTime.Text = ("09:00")If Request.QueryString("showSched") = rdrTimeCompare("bookedDate") ThenIf rdrTimeCompare("bookedTime") = Me.lblTime.Text ThenMe.lblTimeDetail.Text = ("Time Unavailable")End IfEnd If This is draining my will to live. Can someone give me some pointers here? Thanks in advance.  This is definitely not the best wa...

comparing a date with current date in javascript
Hi all,         I've to compare a date with current date, if the difference between two dates is greater than 6 months then user couldn't fill the date into textbox. I'm using 1.1 with C# and this has to done with javascript. can any1 tell me the solution? Regards Anant Something like this: // I haven't tried this, it may not work var startDate = new Date( document.getElementById('<%TextBox1.ClientID%>').value); var currentDate = new Date(); // Compare if ((currentDate - startDate).getMonth() > 6) { // Disable textbox }  Thanks,MaxLet Me Google That For You! Well if the date you are comparing it with is coming from the server, you really should be doing it onthe server adn not the client. If the date is something the user enters, you can do it with JavaScript.  basic idea var date1 = new Date("01/13/2008");var today = new Date();var difference = date1 - today;alert("difference is " + difference + "ms");  I am sure you can figure out the calc for number of milliseconds in six | Twitter epascarello | LinkedIn bullpit,  I think you really need to rethink your example there. What if you are in 2030 with the value in the textbox? | Twitter epascarello | LinkedIn A1ien51:I think you really need to rethink your example there. What if you are in 2030 with the ...

How do I compare the dates in webform with the date in database
Hey all, If i want to check that the date (enter by user) in a webform is not in the list of dates in my database (Microsoft Access) how and what methods can i use? i delcare "BDate" As gobel variable: Dim BDate As String This is my SELECT Statement: BDate = "SELECT BDate FROM Banquetbooking" tb_date is my textbox where user can enter the date I have try using the Compare method but it does not work: Dim t As String = tb_date.Text Dim a As String a.Compare(t, BDate) I also try using the CompareTo method but it does not work: ...

compare server date with entered date
Hi all, i have to compare current date with date which is in data base (expiry date)  if expiry date > server date then delete this record how i compare date and then delete the reocrd ?? Which date i have to take....... > Expiry date  or i have to server date how i can get server date (date which is in server because there is chances that system date is wrong ) what u thing for this task    New In .NET World If you are using SQL Server, simply call a stored procedure thath does this for you - the SP code can check the date in its own SQL - i.e. DELETE FROM yourtable WHERE yourdatefield < getdate()If it was easy, everybody would be doing it. there another way to compare dates without using SQL?I want to create like a horoscope service...For instance, user will enter their DOB and my code will check,if DOB from date1 to date 2 then Pisces, if DOB from date2 to date3 then Scorpio... Sounds simple but I cant get it to work...I tried converting using Convert.ToDateTime(DOB).ToString("dd/MM/yyyy") and then checks if DOB > date..but it doesnt seem to work... Help please?    Horoscope start/end dates fall on particular calendar days, so you will have to write a class to handle this and pass back the correct enumeration.  Since leap years will be involved, you will have some additional work to do.  However, if you simple create c...

Comparing file dates with current date
------_=_NextPart_001_01C39410.65B06B1C Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable I am trying to compare a file's modified timestamp with the current = date. =20 I can use 'stat' to get the timestamp of the file but am not sure how to = compare it to the localtime(). More importantly I want to be able to = quantify the difference in days, month, hours and minutes.=20 =20 Any suggestions? =20 ------_=_NextPart_001_01C39410.65B06B1C-- On Thu, 16 Oct 2003 11:07:44 -0700, Paul Harwood wrote: > I am tryin...

How to : Compare java Date and JS Date ?
Hi all, I can't get it how am I going to do this... compare a value which is java.util.Date to Date.UTC( 2007, 6, 23 ) ? this is how my JS look like :- function compare( mydate ){ if( mydate == Date.UTC( 2007, 6, 23 )){ return true ; } return false ; } Thanks olibralo wrote: > I can't get it how am I going to do this... compare a value which is > java.util.Date to Date.UTC( 2007, 6, 23 ) ? > > this is how my JS look like :- > > function compare( mydate ){ > > if( mydate == Date.UTC( 2007, 6, 23 )){ ...

Comparing dates in Powerbuilder
Hi, I need to find out someone's age as of the previous 31st December to 3 decimal places e.g. 59.499 or 59.501. Is there an easy way to do this other than taking both dates apart and comparing year v year, month v month and day v day? Thanks, Sean I'm not sure where your going with the 3 decimal precision but daysafter() should give you most of what you need when comparing 2 dates HTH Greg <Sean> wrote in message > Hi, > I need to find out someone's age as of the previous 31st > December to 3 decima...

convert date christian date to persian date
hi, I need to convert christain date that was produced in my Sql database to persian date like" دوشنبه 21 مرداد 1378" in a datalist.Could you recommend me any function.I use VisualStudio 2005 & VB. thanks in advance Sepid Take a read of or maybe a javascript route like Hope it helpsRegardsJeremyIf this has helped Please: Don't forget to click "Mark as Answer" on the post that helped you.That way future readers will know which post solved your issue.  If you search Yahoo! or Google it you may easily find it.But you may download PersianDate Web Control at, this is exactly what you are looking for. After installation is completed then try this source: 1 <asp:DataList ID="DataList1" runat="server" DataSourceID="YourSqlDataSource">2 <ItemTemplate>3 4 <%-- Remember that whenever you are displaying a specific date change AutoUpdate to false --%>5 <sim:PersianDate ID="PersianDate1" runat="server"6 AutoUpdate="false" DateValue='<%# Eval("Column_Name_of_Your_Date_Values") %>' />7 8 </ItemTemplate>9 </asp:DataList>  I assumed you are using SqlDataSource   ...

Selecting a Date, and Comparing Dates CLIENT SIDE?
Here's a quick run-down of what's on the page, what I am doing, and what I want to do:I have a calendar object on the page. When you select a date and click a "Set beginning date" button, the date is set to a DateTime variable (server side) and a text box is populated with the m/d/yyyy of that selected date. Then the user selects another date, clicks a "Set end date" button, and the date is set to another DateTime variable (also server side), and another textbox is populated with the m/d/yyyy of the selected date. Unfortunately, clicking the date requires a page reload, as does setting the v...

comparing Database date field with current date
Hi, I'm using & have selected a set of date field and no from my database as shown below. How to do i compare which is the neartest AppDate to current date and i have to set the No as 1 and so on if it's the most nearest to current date. No     AppDate 2       6/15/20081       6/19/20083       6/03/2008 The example is the result i wanted. No     AppDate 1       6/03/20...

compare a date in 1 namespace with a date in another
If you can help please email me and i can send you the project. I need to compare a createdon date from one namespace with the lastlogin date in the current namespace any help would be great. Thanks i didnt get ur question correctly. Do you want to compare two values in two different namespaces right? if then simply import the namespaces or type it explicitly while initiating object. Something like : Ludmal.Businss.UserDateTime date = new Ludmal.Businss.UserDateTime(); Asp.Forum.HisUserDateTime hisLoginDate = new Asp.Forum.HisUserDateTime(); return (if(date.Compare(hisLoginDate...

Compare database date to a hardcoded date
In a reader loop that pulls dates from a column, I want to check the entry for each record against a fixed date: example: January 1, 2007. Here's what I have so far:if (Convert.ToDateTime(reader["MyFieldNameHere"]) > System.DateTime.Parse("1/1/2007 12:00:00 AM")) Larry Dechent - Sampson has 29 examples (C# & VB) to help beginners with ASP.NET. Please let me apologize.  The above code does work after all. When I scaled back my code, I came across a different error that was causing the problem, and when I reinstated t...

How to compare Date values in DataGrid with Current date?
I've got a datagrid with a date value field( called LatestDay) and Iwant to compare it with current date or systemdate. Depending on the difference of currentday and "LatestDay" i want to change the rowcolor in the gridview(or make a image visible maybe) If the difference is 6 days I want the rowcolor to be yellow, 3 days red and so on. How is it possible to fix this? As you probably have noticed I'm not an expert so take it easy when you try to explain. Thanks in advance! Jim Sure, this can be handled in the DataGrid.ItemDataBound event. Simply extract the LatestDay field value from the DataGridItem and compare it to DateTime.Today. Based on your results, you can then set the DataGridItem.BackColor.Thanks, EdMicrosoft MVP - ASP/ASP.NET Here is a basic steps for youprotected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)    {        if (e.Row.RowType == DataControlRowType.DataRow)        {            DateTime olddate = Convert.ToDateTime(e.Row.Cells[0].Text); // Just change the index of cells in the grid to where your Date values reside            DateTime today = DateTime.Now; //Gets the Current Date                    if (olddate > today...

Comparing date from Calendar control with date in Acces db
Hi, I'm making a project for school and we have to set up a site for online ticketing service for TGV. All really simpel and not to extensive. I have the following problem: To select a journy a user have to point out his starting point and his point of arrival. Also they have to give the date of departure. I created two dropdownboxes for the startpoint and the point of arrival. For the date I implemented an Calendar Control. With the following Sql-statement I want to select the right journy for the user: strSql = "SELECT tblStartplaatsen.STARTPLAATS_stad, tblTussenstoppen.T...

search date TO date
Hii still beginner in i want to know how to create search date until date?here is my example:- Hi, I don't see your code------------------------if an answer, mark it so. Hi yanz_shi, As mentioned, we couldn't see your example. Please check the thread after you've created it so that we can help you better. Also, for searching between two dates, you could do it like this: select * from tab where dt between date1 and date2 Thanks.David QianMicrosoft Online Community SupportPlease remember to mark the replies as answers if they help and unmark ...

Comparing file dates from Powerbuilder
I need to compare 2 files from within PB and copy the newest one over the oldest one.Any ideas on how to do this.Win API !!! I know that there a win api copyfile() function but how do I compare the files date and where can i get reference Info on This. Thanks In Advance Daniel Richard.. You may refer to the PFC for a set of win32 file services. The files are: PFCAPSRV.PBL and PFEAPSRV.PBL, refer to object n_cst_filesrvwin32. ...

Web resources about - compare date to a date - sybase.powerbuilder.general

Compare the Meerkat - Wikipedia, the free encyclopedia
Compare the Meerkat is an advertising campaign on British commercial television for , a price comparison website, part of ...

INFOGRAPHIC: How Does Facebook’s Social Jobs Partnership App Compare With LinkedIn?
How does the Social Jobs Partnership application Facebook launched with several partners last November stack up when compared with LinkedIn ? ...

Speak English - Listen, Repeat, Compare on the App Store on iTunes
Get Speak English - Listen, Repeat, Compare on the App Store. See screenshots and ratings, and read customer reviews.

A$AP Rocky compares Danny Brown to ODB - Back & Forth - Episode 1 - Part 2/5 - YouTube
Like This? You Should Subscribe Here Now: Watch Part 3 Next: In part two of 'Back & Forth' A$AP ...

Bieber compares minor Ferrari crash to Princess Diana's death
New York Daily News Bieber compares minor Ferrari crash to Princess Diana's death The aftermath of a crash involving Justin Bieber's ...

How Microsoft Surface tablets compare in a crowded market
... Monday, Steve Ballmer and the other Microsoft execs referred to the company's upcoming Surface devices as tablets. So it makes sense to compare ...

Australian Vaccination Skeptics Network compares vaccines to rape
A controversial anti-vaccination group has likened vaccines that prevent disease to rape, drawing condemnation from even some its own supporters. ...

Compare the Market lifts the lid on fees, ups pressure on iSelect
Compare the Market has disclosed the fee it receives for selling health insurance through its website in a bid to win consumer trust and seize ...

How does Viv Richards' Antigua ton compare with Brendon McCullum's record-breaking innings?
Viv Richards, the original master blaster, owned the world record for the fastest Test century for 30 years. How did his innings compare with ...

Resources last updated: 3/1/2016 11:32:53 AM