DATE field to DATE/TIME

Hello,

If the field is defined as a DATE and you do:

 select datefield+1 from mytable

Does the ODBC API (actually ASA 9.02 backend) return a field that is 
DATETIME or a DATE field?    It is messing up my compiled application and 
seems to be coming back as DATETIME.

Thank you.

-Robert


0
Robert
12/10/2007 4:20:58 PM
sybase.sqlanywhere.general 32637 articles. 4 followers. Follow

1 Replies
779 Views

Similar Articles

[PageSpeed] 47

You are correct, the value is being returned as a TIMESTAMP. You can 
verify this through using the EXPRTYPE() builtin function, as in

select exprtype('select datefield+1 from mytable', 1) from dummy

which will return TIMESTAMP. Exprtype is documented in the help.

You almost certainly don't want to use '+' as the operator to do what 
you're doing. You probably want to use the DATEADD() builtin function 
instead.

Glenn

Robert Paresi wrote:
> Hello,
> 
> If the field is defined as a DATE and you do:
> 
> select datefield+1 from mytable
> 
> Does the ODBC API (actually ASA 9.02 backend) return a field that is 
> DATETIME or a DATE field?    It is messing up my compiled application 
> and seems to be coming back as DATETIME.
> 
> Thank you.
> 
> -Robert
> 
> 

-- 
Glenn Paulley
Director, Engineering (Query Processing)
iAnywhere Solutions Engineering

EBF's and Patches: http://downloads.sybase.com
  choose SQL Anywhere Studio >> change 'time frame' to all

To Submit Bug Reports: http://case-express.sybase.com

SQL Anywhere Studio Supported Platforms and Support Status
http://my.sybase.com/detail?id=1002288

Whitepapers, TechDocs, and bug fixes are all available through the iAnywhere
Developer Community at www.ianywhere.com/developer
0
Glenn
12/10/2007 4:52:46 PM
Reply:

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...

just Time or date portion of a date/time field
Good Day, From a DateTime data column how do I get just a Time portin or just a date portion of data to be displayed. i.e from 11/6/2003 10:03:20 AM I need to display date and time seperately in my data display page. Thanks Regards, In code you could use Dim dt as System.Date Dim day, month, year as integer day = dt.Day month= dt.Month year = dt.Year This also works with DateTime In SQL you could use DATEPART(<datepart>,<datetime>) where <datepart> is the abbreviations mentioned in post 385301 and <datetime> is a...

date/time or date and time
I am setting up an SQL database and I will need to get differences in dates. For example I have a start date, start time, completion date and completion time and I want to get the difference between the start and completion. Would it be better to have one field with both date and time in it, or better to have a date field and a time field? Even though I have already started setting up the tables with seperate fields for date and time I am now leaning toward one field with date/time in it. (Only because that is the way I had to do it when setting up an Excel spreadsheet for a similar ta...

just Time or date portion of date/time field: SOMEBODY PLS
Good Day, From a DateTime data column how do I get just a Time portin or just a date portion of data to be displayed. i.e from 11/6/2003 10:03:20 AM I need to display date and time seperately in my data display page. Thanks Regards, When you pull in a SQL datetime column value into your .NET code, it is usually cast to a .NET DateTime type... something like this: System.DateTime TheDateAndTime = (System.DateTime)someDataReader["MySQLDateColumn"] Then you can use a variety of .NET methods included in the DateTime class to convert to a strin...

Date entered...add time value to make date/time field
Windows XP Professional InfoMaker v 9.0.2 Build 7509 Our database contains a date/time stamp for when a specific activity happens to each shipment. I would like the users to be able to simply enter a date for a specific work day. I need to get a list of shipments where the time of one activity occurred on the entered date prior to 9:20. How can I create a computed field that will basically concatenate/amend the entered date with 9:20 that will later be used for criteria in returning rows? Thanks in advance for any help you can provide! Rita Palazzi Senior Engineer /...

Date field showing date and time
Hey all, I have a datagrid that gets a date but shows the time as well. How do I show only the date? In the database only the date shows up. Thanks in advance, Rodney Hi Rodney, This is a very good date and time formatting article. http://datawebcontrols.com/faqs/CustomizingAppearance/FormatDateTimeData.shtml Hope this helps U. Thanks!Regards, Dj Dev Here's how I do it: <asp:TemplateColumn HeaderText="Required Date"> <ItemTemplate> <%# DataBinder.Eval(Container.DataItem, "ReqDate", "{0:MM/dd/yyyy}") %&...

Missing date in time/date field
Hi, I noticed that some postings (including mine) don't show the date, just the time of sending the message. What setting do I need to change to enable this? MegaMad - Leo MegaMad wrote: > Hi, > > I noticed that some postings (including mine) don't show the date, just > the time of sending the message. > > What setting do I need to change to enable this? > > MegaMad - Leo Any post sent today will only show the time, those same posts will show the date and time tomorrow. -- Brian .. http://www.mozilla.org .. http://ilias.c...

Inserting Date into Access Date/Time Field
Everytime i capture a date from an asp:dropdownlist and try to insert it into an access date/time field i keep getting a Data type mismatch in criteria expression error (0x80040e07). is there a way i need to format the data before inserting? Any help would be ace!1 using System; 2 using System.Data; 3 using System.Data.OleDb; 4 using System.Configuration; 5 using System.Web; 6 using System.Web.Security; 7 using System.Web.UI; 8 using System.Web.UI.WebControls; 9 using System.Web.UI.WebControls.WebParts; 10 using System.Web.UI.HtmlControls; 11 12 ...

No date in Date field
I have just installed thunderbird on my system. I migrated from outlook express. All the mail that was there before shows both the date and the time in the date field. However, all mail received by thunderbird only has a time stamp, no date. How do I correct this?? Thanks, Roger _Roger Bailey_ spoke thusly on 29/08/2006 10:09 PM: > I have just installed thunderbird on my system. I migrated from outlook > express. All the mail that was there before shows both the date and the > time in the date field. However, all mail received by thunderbird only has ...

date field = date
i made an news table and i made and option to add and update and delete news from it i need one thing that when someone try to add news the time that he insert the news will be in teh date field of the table and dont the costumer write it   hope that u understand me Hi, did you mean you want to add a column that get current date as its value automaticly? If so, you can do the following in Access2003: 1. add a column with 'Date/Time' data time 2. In the 'Field Properties'->'General' pannel, add a 'Default Value' for it, 3. In the 'Expression Builder', double cli...

How to convert a date field to short date? without time.
I am using a query builder to buld a sql statement which brings me somes fields which are defined as date, and they are brought like this one: 5/17/2006 12:00:00 AM and I just want to bring the 5/17/2006.I tried CONVERT (CHAR(10), Fecha_evento, 101) AS Fecha_evento  It works, for displaying, but when I try to look for the maximun within that field, it interprets it as a string, so I do not get the right value.  Do you have a way to solve this? thanks a lot! There's really no such thing as a date without a time.  If you're having problems with displaying the information ...

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: http://forums.asp.net/t/1346328.aspxMohsin Naeem"Please mark as answer if it helped you"  <form id="form1" runat="server"> <asp:ScriptManager ID="ScriptManager1" runat="server"> </...

java date time and utc date time
hi i have a client written in delphi the backend is written in java (webservice) when fetching a date field from the db, through java to delphi (TXSDateTime class), for some reason the date changes. in the db: 30/07/2009 00:00:00 in delphi: xsdatetime.asdatetime = 29/07/2009 23:00:00 (1 hour before) in delphi xsdatetime.asutcdatetime = 29/07/2009 21:00:00 (3 hours before) i guess it's a matter of timezones but all we want is simply to fetch the same date as it appears in the DB what are we missing? thanks amos szust wrote: > hi > > i have a client written in d...

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...

Web resources about - DATE field to DATE/TIME - sybase.sqlanywhere.general

Resources last updated: 11/27/2015 9:50:18 AM