Convert Date/Time to Date


I'm using .NET 2.0 framework with a Postgres DB. I'm getting date values from the table 'creationdate' and I need to compare it with other date value (given by me). The thing is that tha date returned from the DB comes like this '27-03-2006 0:00:00' and the date value that I use to campare comes like this '27-03-2006'. I want to know how to convert the returned date value from the DB to date only...?!

I tried using the following:

SELECT CONVERT(char(10),creationdate,101) AS date FROM WHERE date = "myDate";

but it gives me an error: syntax error at or near "," at character 24

Can someone tell me how to do this?!

André da Silva Carrilho

If the post has been answered please marke it as Answered :-)
3/27/2006 8:34:53 AM 819 articles. 0 followers. Follow

1 Replies

Similar Articles

[PageSpeed] 37

HI U Can Use TSQL Trick Mentioned Below



Please Mark as Answer if it solved ur problem.

Naveen Kokcha
Web Application Developer
Avinex Soft Private Limited.
3/20/2008 12:55:10 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...

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

how to convert date time to just date
 Hi Guys,               I am pulling a date from the datatable the formate i am getting is like this 8/14/2008 12:00:00 AM  but i don't want to show time with it.  I know i can get this by doing something like this Format(trainingExpiry, 'dd/mm/yyyy') AS trainingExpiry  in my SELECT statement but i dont want to do this in my select statement.  I want to change date format in my C# code.  Can anyone tell me please how can i get the desired date formate.  thanks in advance. ALI&...

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

How to convert Julian date into Calendar date (VB.Net)
Hi all, I have some dates which are in Julian format and I need to convert them into calendar dates  for example if the Julian date is 1, I need to be able to convert it into 1/1/2007, If the julian date is 66 then I would need to convert it to 3/7/2007 and so on. Every year would start with 1 and end with 365365 = 12/31/2007. Is there a function or tutorial somewhere ? thanks for any help.    1) Your dates aren't in Julian format!! 2) How do you know which year you are referring to? 3) Have you tried the AddDays function of the Date/DateTim...

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

Date time string error
Hi all, Just downloaded the club site starter and was hit with the following error on the events calendar page: String was not recognized as a valid DateTime. I have just taken a minute to fix it and thought i would share. The steps i performed are listed below: Download EventCalendar code from Copy the unzipped folder into my club site project Add the project into my club site solution Alter the method CreateDataBoundChildren(System.Data.DataView dv, Table table, DateTime todaysDate, DateTime visibleDate, System.Global...

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

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

How to convert date-time format to Oracle Date Format DD-MM-YY?
I get a resultset through Jaguar from Oracle7. The resultset is forwarded to query object which bounds to grid object. Things works fine with datatype being NUMBER, VARCHAR2. But if I have a colmun whose datatype is "Date" and is formatted as "DD-MON-YY" where "MON" is from "Jan" to "Dec". What I will see from my grid display is: "YYYY-MM-DD:HH:MM:SS.SS". So how can I convert this date-time format to be displayed as an Oracle recogniziable Date format (DD-MM-YY)? This conversion also prevents a problem of updating s...

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 raw date time
I have a value in a string array that is {3/15/1976} When I do a tostring with a short date it changes that to 15/03/1976 Is there a way I can get just the raw text out of the string? Without it giving it to me as a date? Thanks Hi latrotter2, If you have a DateTime object and want to the string value to have a certain format, you must pass the format to the .ToString() Methos. Example: [Visual Basic] Dim tempDateString As String = DateTime.Today.ToString("M/d/yyyy") Response.Write(tempDateString) [C#] string tempDateString = DateTime.Today.ToStr...

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

Web resources about - Convert Date/Time to Date -

Resources last updated: 11/25/2015 4:53:50 AM