select statement to get date from datetime field... help

Hi All,

Could someone please help how to compose select statement to get date only from date/time field in ms access? In sql server there is convert function but i have ms access here...

Regards,

Paul

 

0
klakieros
5/19/2008 9:50:17 PM
asp.net.access-datasource 4679 articles. 0 followers. Follow

5 Replies
501 Views

Similar Articles

[PageSpeed] 10

You can use the Format function. See #8 in http://articles.techrepublic.com.com/5100-10878_11-6135056.html


If this post was useful to you, please mark it as answer. Thank you!
0
johram
5/19/2008 9:59:04 PM

That's a useful article Johan has linked to, but my preference is to get the whole value of the field out of Access, then use string formatting in ASP.NET to change the way it displays: http://www.mikesdotnetting.com/Article.aspx?ArticleID=23

 


Regards Mike
[MVP - ASP/ASP.NET]
My site
0
Mikesdotnetting
5/20/2008 7:27:37 AM

I had a chance to look at the article from johram link.

so can I for example do the following:

SELECT FORMAT(myDatetimFileds, "d") FROM myDatabase 

   
0
klakieros
5/20/2008 12:31:48 PM

 

klakieros:

I had a chance to look at the article from johram link.

so can I for example do the following:

SELECT FORMAT(myDatetimFileds, "d") FROM myDatabase 

Yep, but using "d" as format will only give you the *day* part of the date column.

It might be a better approach, as Mike suggested, to do the actual formatting in your ASP.NET code instead.


If this post was useful to you, please mark it as answer. Thank you!
0
johram
5/20/2008 1:41:20 PM

perfect! Yeah, that 'd' was just the example copied. Fantastic job again guys!

Thank you!

0
klakieros
5/20/2008 5:25:56 PM
Reply:

Similar Artilces:

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

How to get the field of datasource that is not selected in the gridview
Dear All,   There is a data source which select Fields A, B, C and D. A Gridview displays this data source and selects the fields A, B and C.   There is a template field of linkbutton, and on linkbutton click, I cannot get the      GridViewRow gvRow = (GridViewRow)linkbutton.parent.parent.   How to get the Field D from the data source?     Thanks. Would gvRow.Cells[3].Text get you your value?jameswrightwww.jwright.info"Never be so busy making a living that you forget to make a life." can u post the code ??  Jai Ganesh. ...

Select all dates from SQL datetime field
I have a form that's filtering search results and porting to a gridview. The drop down is selecting from the date column of SQL, but i want it the default value to show all dates in the gridview. In a normal string field, you can just use "%", but a datetime field won't take this. What can i use to show all dates? Can you post the SQL you have currently and how the value from the ftont-end is passed to the DB?***********************Dinakar NethiLife is short. Enjoy it.*********************** <asp:SqlDataSource ID="LDSSqlDataSource1" runat="serve...

getting just the date or from DateTime field
Hi, I have used smalldatetime datatype to store my date and time values. i want to store just the date or time but the problem is it stores both the date and time. For eg, if i add the the date 03/11/2004, it also the stores the current time automatically. so the new value will be something like 03/11/2004 10:00:00 AM where i want just 03/11/2004. further problem is even though i managed to store just the date like 03/11/2004 in the database, whole date and time shows up when i display it in my pages. any help will be appreciated. thanx,-keeara g------------------ If i want to dis...

SELECT from DateTime field based on current date
I am trying to match records that are >= the current date. I have tried using: SELECT DISTINCT name FROM table WHERE datefield >= DATEPART(month, GETDATE()) AND datefield >= DATEPART(day, GETDATE()) AND datefield >= DATEPART(year, GETDATE()) ORDER BY name but this is not giving me the result that I am looking for. What is the best way to match a DateTime field type using the current date without the time? SELECT DISTINCT name FROM table WHERE MONTH(datefield) >= DATEPART(month,GETDATE()) AND DAY(datefield) >= DATEPART(day,GETDATE()) AND YEAR(datefi...

Display Selected Dates in .NET Calendar Control..HELP!
Okay, I am a newbie to ASP.net, so hang with me here! I need to create a data-driven calendar using the ASP.net calendar control and an existing Oracle database. I followed the MSDN "How to" ( http://msdn2.microsoft.com/en-us/library/ms228044(VS.80).aspx ) utilizing the SQL database without a problem; however, once I recode to use my Oracle connection string and database, I receive an ArgumentException that says "Keyword not supported: 'Unicode'." at the connection string variable. I have imported the System.Data. & System.Data.SqlClient namespaces, but now I'm wonder...

Problem getting focus in fields containing date and datetime
I've PB 5.0.4 on NT 4 with several applications which use different databases (Oracle, Informix and Access). My problem refers to only one of these (the Oracle one): when a field (in a datawindow or in a window) get focus, the editing size is reduced. The fact is that I have a lot of date field that crash becouse of the field size is measured. My colleagues does'n have the problem in spite of the sources are the same (but the OS is different, they have windows 95-98) Probably this is since I've installed PB 7 on my machine. Thanks Matteo Date fields under NT4 have...

HTLM encodeformatstring of selected field of edit field of gridview ? datetime ? datetime.now () and insert code lines
hi friends i changed HTLM encodeformatstring of selected field of edit field of gridview as false.. i also changed HTLM encode as false..i entered dataformatstring as {0:DD/MM/YYYY} then i tried below code line for inserting record.. datatype of table1 is datatime.. thic code lines run good before i changed HTLM encodeformatstring and HTLM encode and dataformatstring.. but this code lines doesnt run now. inserting of my backup web sites doesnt work.. i think that datetimeformat of my computer changed.. How can i fix it ? What can problem be ? Cheers sds.ConnectionString = C...

Comparing a field to a field in Access
I can't get this to work.  Seems simple enough.  I have a table "Gifts" that contains gift certificates.  Two of the fields are called "Amount" and "AmountUsed"  -- I would like to find all gift certficates that are not fully used, i.e.: SELECT * FROM [Gifts] WHERE ([AmountUsed] < [Amount]) However this query always returns 0 rows!  I have even tried: SELECT * FROM [Gifts] WHERE ([AmountUsed] <> [Amount]) And always get back 0 rows.  What am I doing wrong? Thanks!-Joe   Is one of the two columns being compared a nullable column?  Also,...

get only date from a date with a datetime format
i have a problem with dates when it comes to searchingbasically, 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 RequisitionNoFROM RequisitionsWHERE (RequisitionDate = @RequisitionDate) AND (RequestorCode = @RequestorCode) take a look with this, don't just accept influenceshttp://thedailyarr.tkhttp://www.ftpx.com/index...

get a date from two date field
how to use a stored procedure to get a date which is start_date + due_date. stare_date and due_date are data field. dats type are smalldatetime. database is SQL 2000.   Give an example of what you want..... Do you want something like 12/12/2005 12/25/2005 ? Eric RamseurRainbow Portal 2.0 AdminDownload Rainbow 2.0!!Rainbow Code Rainbow Portal CommunityC# 2005 Group I need a date, 60 days before start date +  due days. For example, start is 12/03/2005(smalldatetime) Due days is 20(int).   start date + due day - 60 is 10/23/2005. that's what I...

Access to a field from my Access DataSource in my DetailsView
I am creating an Audit Trail of changes made to my table using a DetailsView RowUpadated event. This field,  CustomerName, in the table is not being updated so I can not grab the data from my  DictionaryEntry  old or new values statements as I am doing for my audit trail. However, it is in my select statement for the DetailsView from my AccessDataSource. I can’t seem to find a reference where I can get the value of a field from my AccessDataSource. How can I reference it ?  Thx.           <asp:DetailsView ID="DetailsView1" ...

select statement usind Date function and Intersolve ODBC datasource
I retrieving data with a datawindow that is connected to and Intersolve ODBC datasource (.dbf file). I need to retriece records after a certain date, so I was trying to us a select statement similar to this: SELECT table.column, table.column2, ... WHERE table.column2 >= DATE( '01/01/1990'); I get this message when trying to save the SQL statement: SQLSTATE = 37000 [INTERSOLV][ODBC dBase drive]Incorrect number of arguments to function: DATE. I can not find any document to provide me the proper syntax to the DATE function. Has anyone had any experience with this ...

select statement usind Date function and Intersolve ODBC datasource
I retrieving data with a datawindow that is connected to and Intersolve ODBC datasource (.dbf file). I need to retriece records after a certain date, so I was trying to us a select statement similar to this: SELECT table.column, table.column2, ... WHERE table.column2 >= DATE( '01/01/1990'); I get this message when trying to save the SQL statement: SQLSTATE = 37000 [INTERSOLV][ODBC dBase drive]Incorrect number of arguments to function: DATE. I can not find any document to provide me the proper syntax to the DATE function. Has anyone had any experience with this ...

Web resources about - select statement to get date from datetime field... help - asp.net.access-datasource

User:Jimbo Wales/Statement of principles - Wikipedia, the free encyclopedia
As we move forward with software and social changes, I think it is imperative that I state clearly and forcefully my views on openness and the ...

Category:Articles containing potentially dated statements from July 2011 - Wikipedia, the free encyclopedia ...
This is an administration category . It is used for administration of the Wikipedia project and is not part of the encyclopedia. It contains ...

Paris attacks: Grand Mufti of Australia Dr Ibrahim Abu Mohammed issues clarifying statement condemning ...
The Grand Mufti&nbsp;of Australia says he has always &quot;consistently and&nbsp;unequivocally condemned all forms of terrorist violence&quot;. ...

"No justification for the taking of innocent lives": Mufti clarifies statement
The Grand Mufti of Australia has hit back at criticisms that his comments following the deadly Paris attacks justified terrorism, saying he &quot;unequivocally ...

"Welcome to our home. Please take a moment to review our latest statement regarding so-called micro-aggressions..." ...
"... together with a revised list of 'trigger warning' requests. Kindly commit the following to memory...." Trigger warning for Althouse readers: ...

Liveblogging World War II: Robert H. Jackson: Opening Statement before the International Military Tribunal ...
**Robert H. Jackson**: [Opening Statement before the International Military Tribunal](https://www.roberthjackson.org/speech-and-writing/open ...

Eagles of Death Metal issue statement on Paris terror attack
Previously: Josh Homme's Sweet Stuff Foundation raising money for families of Paris attack victims Nick Alexander was Eagles of Death Metal's ...

ISIS is 'trying to taunt' Anonymous with a new statement on the hackers' declaration of 'war'
A propaganda account affiliated with ISIS has released another statement related to the hacking collective Anonymous' declaration of "war" on ...

Protective case turns your sleek iPhone into a loud fashion statement
... iDevice cases are loud and rugged. You might even call them masculine, although I know a few of my female friends would embrace the bold statement ...

Lynch: Obama’s Statements Have ‘No Influence’ On Clinton Investigation
Does the DOJ 'allow statements by the president to dictate its investigative practices?'

Resources last updated: 11/25/2015 9:28:43 AM