get only date from a date with a datetime format

i have a problem with dates when it comes to searching

basically, SQL searches for a date including the seconds,

but i only need to date so that in any given time, it will yield a result.

here's a part of my code-behind code:

reqNo = RequisitionsLogic.GetReqNoByDate(currentDate, requestorCode)
and here's the SQL statement created in a TableAdapter:
SELECT     RequisitionNo
FROM Requisitions
WHERE (RequisitionDate = @RequisitionDate) AND (RequestorCode = @RequestorCode)
 take a look with this,
 

don't just accept influences

http://thedailyarr.tk
http://www.ftpx.com/index.html
0
extinct_pirate
10/17/2008 4:34:28 PM
asp.net.object-datasource 16182 articles. 0 followers. Follow

5 Replies
1170 Views

Similar Articles

[PageSpeed] 3

SELECT     RequisitionNo
FROM         Requisitions
WHERE     RequisitionDate between '10/17/2008' and '10/17/2008 23:59:59.997'

 

 This article explains some more about it.

0
IzodMungo
10/17/2008 4:47:04 PM

IzodMungo:

SELECT     RequisitionNo
FROM         Requisitions
WHERE     RequisitionDate between '10/17/2008' and '10/17/2008 23:59:59.997'

 

 This article explains some more about it.

 

hi IzodMungo,

the SELECT statement you see is part of a BLL method that is globally used by the whole project.

and the message box you see is just for testing purposes,

and before i display that message box,

the page inserts a new row to a table

every row has its own unique identifier, in this case, its ReqNo

and it should be fetched from the newly created row.

if you we going to use your suggestion, dates after 10/17/2008 and 10/17/2008 23:59:59.997 is not included anymore,

what im asking is how to extract only date from the currentDate. thanks in advance

 


don't just accept influences

http://thedailyarr.tk
http://www.ftpx.com/index.html
0
extinct_pirate
10/17/2008 5:41:46 PM

extinct_pirate:

but i only need to date so that in any given time, it will yield a result.

You have to supply time to get the accurate results. If you want to search between days, for example, you have a from date and a to date:

fromDate = date + " 12:00:00 AM"
toDate = date + "11:59:59 PM"

 


Thanks,
Max
Let Me Google That For You!
0
bullpit
10/17/2008 5:58:08 PM

It sounds like you are trying to format the DateTime string, can you clarify when/where you are trying to do this?

I think the db will always return the full string, so you will need to provide the desired format where you are using it.  You probably want the short date format, for example

DateTime.Now.ToShortDateString();
String.Format( "{0:d}", DateTime.Now );

Both will return the string "10/17/2008"

 
Some other fun string formats

 

 

0
IzodMungo
10/17/2008 6:30:25 PM

IzodMungo:

It sounds like you are trying to format the DateTime string, can you clarify when/where you are trying to do this?

I think the db will always return the full string, so you will need to provide the desired format where you are using it.  You probably want the short date format, for example

DateTime.Now.ToShortDateString();
String.Format( "{0:d}", DateTime.Now );

Both will return the string "10/17/2008"

 
Some other fun string formats

hi IzodMungo,

thank you for your suggestion, it worked! coz its hard to be a beginner.


don't just accept influences

http://thedailyarr.tk
http://www.ftpx.com/index.html
0
extinct_pirate
10/18/2008 4:15:51 AM
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...

saveas EXCEL
Hi all, I need to save a report in Excel format, this is how i've tried to save it, but the only result is that i get date, and datetime field in the datawindow saved in a personalized format not in the proper one (date, and datetime formats), so i'm asking help to sb more expert than me. I'm using Powerbuilder 5.0.0.4, Windows NT, Oracle. Thanks in advance. Luana string docname docname = "C:\Documents and Settings\Administrator\Desktop\report1.xls" if dw_1.SaveAs(docname,excel!,true) <> 1 then messagebox("Error","Uncorrect Save of Fil...

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

Getting date and datetime system formats
Hi, How can I get the default date and datetime formats PowerBuilder uses for string conversion? Thanks in advance, Yves. I believe that PB checks the Windows regional settings and uses the values there. On Wed, 28 Feb 2001 11:18:16 +0100, in powersoft.public.powerbuilder.powerscript Yves Joosen <yves.joosen@be.xrtcerg.com> wrote: >Hi, > >How can I get the default date and datetime formats PowerBuilder uses for >string conversion? > >Thanks in advance, >Yves. > > Bruce Armstrong [TeamSybase] http://www.needhim.org ---== Po...

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

saveas EXCEL
Hi, I need to save a report in Excel format, this is how i've tried to save it, but the only result is that i get date, and datetime field in the datawindow saved in a personalized format not in the proper one (date, and datetime formats), so i'm asking help to sb more expert than me. I'm using Powerbuilder 5.0.0.4, Windows NT, Oracle. Thanks in advance. Luana string docname docname = "C:\Documents and Settings\Administrator\Desktop\report1.xls" if dw_1.SaveAs(docname,excel!,true) <> 1 then messagebox("Error","Uncorrect Save of File&qu...

Parse DateTime into Date or select DateTime as Date from Access
I am getting DateTime values out of an Access Database and I want to only use the Date part of this field. I have tried to cast the returned value to a DateTime value and then format the DateTime to only show the Date part in the toString() fcn. <asp:Label runat="server" Text='<%# getDate(DataBinder.Eval(Container, "DataItem.ACTIVE_FROM"))%>'> But I can't cast the object to a DateTime object. I have also tried using DateTime.Parse() but this gives an error saying that the format is not correct.         {       ...

Get the dates between two dates
Hi all, I want to get all the date between two dates. For example I have a StartDate="12/5/2003" and a EndDate="12/7/2003" the result should be 12/5/2003 12/6/2003 12/7/2003 Ant help is appreciated Thanks for ( DateTime theDate=StartDate ; theDate<=EndDate ; theDate.AddDays(1) ) { // Do something...theDate.ToShortDate() would give the string... } Starting with ASP.NET 2.0? Look at:Programming Microsoft Web Forms My Blog I get a syntax error as :"For loop variable cannot be of type Date" Hmm. The below work...

Getting dates between 2 dates
Hi all, Would like to make an enquiry, if i have 2 dates, how can can i get all the dates between these 2 dates. Thanks for the help.   You will probably need to loop through the dates;               DateTime startdate;            DateTime enddate;            List<DateTime> allDates = new List<DateTime>();            allDates.Add(startdate);         ...

Date Formats and other date errors
I'm having problems with Date formats. I can only enter dates in American format mm/dd/yyyy. My regional settings, dw and everything I can find says the format is dd/mm/yyyy but say for 29-feb-2000 I have to enter 2/29/2000. Also although my dates display ok upon retrievel as soon as a date field gets focus its' contents change to undefined ( a java error of some sort). I've got all the HTML generation check boxes ticked, I'm using Maintenance release 7.2 of PowerBuilder with Powersite, NT4, MIIS personal web server with MTS running against an Oracle 8.0.6 database. ...

getting date in between 2 date
how do i get the date in if it is within the 2 date? er... don't know how to phrase i think my sql is something like this: SELECT * From Transaction WHERE Date BETWEEN 01/08/1900 AND 31/08/2000 BTW i declare my Date as date/time(short date) is it possible with the sql? it display Syntax error in FROM clause. SELECT * From [Transaction] WHERE [Date] BETWEEN #01/08/1900# AND #31/08/2000# Now, this presumes that the machine in question is expecting dates in dd/mm/yyyy format. Note that Transaction and Date are likely reserved words, and so I have enclosed them in [ and ...

date format, date order
SQL Anywhere 9.0.1.1751 I have a .csv file that is HUGE. It contains dates in the form of 'mm/dd/yyyy'. I need to import this into a ASA 9 db. I cannot open this in excel and edit the dates because it will cut off some data. I'm going to need to do this on the SQL side. I've tried... SET OPTION DATE_ORDER = 'DMY'; SET OPTION DATE_FORMAT = 'MM/DD/YYYY'; ....it still will not recognize it. There has to be a way to do this, right? Steve wrote in news:42e8166b.4653.1681692777@sybase.com: > I've tried... > > ...

How to get todays date in format YY/MM/DD and to compare it to another date passed into the sql
I need to do the following and am hoping someone can help me out. I have C#(asp.net app) that will call a stored procedure. The C# will pass in a date to thestored procedure. The date is in the format YY/MM/DD. Once inside of the stored procedure, the datepassed into the stored proc needs to be compared to todays date. Todays date must be determined inthe SQL. So basically here is my pseudo code for what I am trying to accomplish. Basically I just am afterthe comparison of the two values: If @BeginDate < TodaysDate The difficult part is how to obtain the value for "TodaysDate&qu...

How can I get the DateTime.now to display in english date format
I have to get the System.DateTime.Now to display the date in the format : Day/Month/Year as opposed to the american Month/Day/Year. Anyone know how to do this. Heres my code: private void C1WebGrid1_ItemDataBound(object sender, C1.Web.C1WebGrid.C1ItemEventArgs e) { C1ListItemType lit = e.Item.ItemType; String jobDueByDate; DateTime TodaysDate = System.DateTime.Now; if (lit == C1ListItemType.Item || lit == C1ListItemType.AlternatingItem) { DataRowView drv = (DataRowView) e.Item.DataItem; jobDueByDate = drv[JobData.DUE_DATE_FIELD]...

Web resources about - get only date from a date with a datetime format - asp.net.object-datasource

Is there a JQuery plugin to convert UTC datetimes to local user timezone?
If I have a tag: &lt;span class="utctime"&gt;2010-01-01 11:30 PM&lt;/span&gt; I would like a jquery script or plug in to convert every utctime ...


Targetprocess 3.7.3: Epic unit for Bug/Story cards, new DateTime functions in Webhook plugin
Webhook plugin supports new DateTime functions AddDays(DateTime date, int days) – Returns a new date with the number of days added. The number ...

Common Pitfalls when working with DateTime’s
In .NET, the DateTime structure provides us wonderful functionality, but this seemingly simple structure can cause a lot of headaches if you ...

Parsing Twitter Date format to .Net DateTime
Recently when I needed to parse the twitter datetime format into a .Net DateTime I found this post on the web showing how to do it. However, ...

C Sharp (programming language) - Wikipedia, the free encyclopedia
(pronounced see sharp ) is a multi-paradigm programming language encompassing strong typing , imperative , declarative , functional , generic ...

1753 - Wikipedia, the free encyclopedia
Language: English Afrikaans አማርኛ العربية Aragonés Asturianu Aymar aru Azərbaycanca বাংলা Bân-lâm-gú Basa Banyumasan Беларуская ‪Беларуская (тарашкевіца)‬ ...

Coded Smorgasbord: Schizophrenic Haiku Comments and More
... writes Malcom StandardResponse UnSubscribeNewsletterUserAccount( string opTinGUID,string email, string sellingRegion, string source, DateTime ...

Limburg.be - Welkom op de site van de provincie Limburg - Welkom_op_de_site_van_de_provincie_Limburg
visit wonen werken leven ontspannen infopunt home op trefwoord contactpersonen wegwijs sitemap print deze pagina Je bent hier: limburg.be Contact ...

Simples Ideias. Por Nando Vieira.
Simples Ideias Siga-me no Twitter Junho/2012 Usando o Vagrant como ambiente de desenvolvimento no Windows http://simplesideias.com.br/usando ...

Resources last updated: 12/19/2015 2:30:56 AM