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 the
stored procedure. The date is in the format YY/MM/DD. Once inside of the stored procedure, the date
passed into the stored proc needs to be compared to todays date. Todays date must be determined in
the SQL.

So basically here is my pseudo code for what I am trying to accomplish. Basically I just am after
the comparison of the two values:

If @BeginDate < TodaysDate

The difficult part is how to obtain the value for "TodaysDate"

Taking into consideration that "TodaysDate" should probably be in the format of YY/MM/DD considering that is how the date it is to be compared with is being passed in.

Can someone please code this out for me in Microsoft SQL. I would be forever grateful.

0
brgdotnet
12/11/2007 5:55:50 PM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

1 Replies
1312 Views

Similar Articles

[PageSpeed] 22

I figured out what I needed to know, but will have further questions and will need help. Thanks to all.

0
brgdotnet
12/11/2007 9:14:58 PM
Reply:

Similar Artilces:

How to change date format from mm/dd/yy to dd/mm/yy
Hi, Anybody can suggest how I can change the date format on the database to dd/mm/yy instead of the defauly mm/dd/yy? I tried running the sp_addlanguage command, but it seems that it still does not work. From what I understand, this is for a new language set. But in my case, I want to retain the default language, but only change the date format. How do I do it? Thanks!! ---== Posted via the PFCGuide Web Newsreader ==--- http://www.pfcguide.com/_newsgroups/group_list.asp Try the following statement: select convert(char(10), FIELD_NAME, 3) from TABLE_NAME Penguin ...

How to change date format from mm/dd/yyyy to dd/mm/yyyy in sql server 2005 express edition
I have a page where i m showing some data and date which is in mm/dd/yy format in detail view,but i want to show date in dd/mm/yy format. I tried but it didn't work.What should i do. Please help me out. ThanksWeb DeveloperPune,India Hi here is the sample query. SELECT CONVERT(VARCHAR(20), GETDATE(), 103)Hope this will work.  Valentine Day Special SongASP.NET ListView Control  I don't think you need to change the representation of dates in Sql Server, but only how they are presented in the DetailsView.  For that you can use a dataformatstring of "{0:...

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

Get Date and compare with Date.Now in T-SQL
I am trying to set an alert to user for a project which will due on the particular date. How to compare the DateTime due date  which I get from the database with the Date.Now in stored procedure? Thanks in advance.Best regards,Ron. Make sure they are both in the same format. Many different ways to accomplish. The example below would convert both to a date: select * from table where convert(nvarchar(15),DueDate,101) = convert(nvarchar(15),Date.Now(),101) Thanks samsta, but I got an error when I am using Date.Now(). Then, I change with GetDate() function and works just ...

Date Format Problem; need 'dd/mm/yy' not 'mm/dd/yy'
I have the following problem when supplying a date to a sp date parameter: If I run with parameter formatted as 'dd/mm/yy' then I get 0 records because, I guess, sql expects first part to be 'mm'. I have windows and EM set as 'English' (i.e. 'dd/mm/yy'). The values in the tables also display as 'dd/mm/yy', so: 1) WHY must I supply a date parameter for a sp as 'mm/dd/yy'. 2) How should end users enter the date. 3) Can I store 'dd/mm/yy' and 'mm/dd/yy' format dates in the same table? Please help, I am a little confused. Thank you in advance. Regards - Rehman ::WH...

How to get the current date in C# and how do I pass this date to SQL Server
I am writing a ASP.NET C# web application. I will need to store the date in one field in one of my tables. It appears that I need to use the datetime data type for the date in SQL Server 2005. So I have a question 1.) How do I get today's date in C# and how should this be passed to SQL server? you can get the current date directly in SQL using getdate()KH Doing it in C# will return you the client system date. Getting the current date in SQL will ensure all datetime recorded in your application are in sync. If you are using the date for some sort of comparison determine the sequence of ...

Comparing a Date Value in SQL against Today's Date
I have a query that accesses a series of events in a gridview and would like to only show those that are in the future. I am looking to compare the date/time column against today's date in my SQL query.Any ideas would be great.ThanksOrbital you can use the t-sql function: getdate() in your queryMike Banavige~~~~~~~~~~~~Need a site code sample in a different language? Try converting it with: http://converter.telerik.com/...

how to show date in dd/mm/yy format when date selected from calendar control.
Hi How to display date in format in dd/mm/yy using calendar control.When user select date from calendar control By default it showing mm/dd/yy.How can i do this. Rahul  I haven't used the calendar controls in VS2005 but have a play with "DateTime.ToString("DD-MM-YYYY")" That's how I manipulate DateTime objects when presenting them in English format  http://www.obout.com/calendar/tutorial_titletext.aspx check that out, especially the part about settting date formatsPlease remember to click "Mark as Answer" on this post if it helpe...

getting current date in mm/dd/yy format
Hi, how can I get current date only , not time, in mm/dd/yy format?? DateTime.Today.tostring(); returns both date and time and not in the mm/dd/yy format. Also, in case of 8/1/04, how can I change it to 08/01/04 ?? :: how can I get current date only , not time, in mm/dd/yy format?? DateTime.Now.ToString("MM/dd/yy") :: Also, in case of 8/1/04, how can I change it to 08/01/04 ?? DateTime.Parse("8/1/04").ToString("MM/dd/yy") Jigar Desai-----------------------Do not forget to "Mark as Answer" on the post that helped y...

Insert date in SQL in dd/mm/yyyy format
hi everyone, I'm doing my academic project. In that I used SQL command to insert data into table but in many forms it works and many it doesn't. It shows the following error "The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.The statement has been terminated" I'm using dbCommand.CommandText = "Insert into EstApproval values(" & ViewState("tr_no") & ",'" & Format(CDate(txtEstDate.Text), "dd/MM/yyyy") & "'," & txtAtCost.Text & "," & txtEstAmt.Text & "," & txtPerAtCost.Text & ",'" & rblTcStatu...

US date format dd/mm/yyyy gets converted to mm/dd/yyyy
Dear All,I got an sql query that I pass to sql server as a string. I pass a date as a string in the query and compare it to a date in a table.The trouble is somewhere in the process I get ‘01/04/2006’ turned into ‘04/01/2006’ I do understand mm/dd/yyyy is the US date format. The problem is I pass in dd/mm/yyyy and I compare it to dd/mm/yyyy, however it is dd/mm/yyyy gets compared to mm/dd/yyyy for some reason.I tried the 3 variations below, but none works ok, suggesting that the conversion takes place somewhere #in between’. Can someone tell me how to solve this?<code>Dim myDat...

Daterange Picker Calendar control Without clicking Start Date and End Date Separately ( dd/mm/yyyy-dd/mm/yyyy format
Hello all,  Plz Suggest me the Daterange Picker Calendar control . so that i can select a range of date (after clicking on button javascipt calendar will be executed) and date will appear in the format dd/mm/yyyy-dd/mm/yyyy in listbox (like without cliking for Start Date and End Date Separately)  Swati Jain   Check this:http://www.codeproject.com/useritems/DateRangePicker.asp NC... Some of the third party Calendar controls allow multiple selections. If they support the ability to just click on the start and then end dates to form a range, or can limit the u...

data types for zip code and date (mm/dd/yy) in sql database
Hello All,i have a sql database with a table as follows.  CustID (PK, Varchar(50) not null )Address ( VarChar(max), null)City ( VarChar(max), null)State( VarChar(max), null)Zip ( VarChar(5), null) ----------------------------- this is not working cuts off the leading zero like ( 01234) is shown as 1234DateShipped( datetime, null) --------------------- this display 05/18/2008 12:00AM. i just want to display (05/18/08).how can we do the above two. any suggestions please. i tried smalldatetime no luck . i appreciate it.Thanks.   1. For ZIP, it is impossible for a Varcha...

Set the date format to be 'dd/MM/yyyy' for an SQL Server database
Hi, How can I set the date format to be 'dd/MM/yyyy' for an SQL Server database (to apply in all tables' dates) ? Thanks a lot in advance!      Do you need to have the date stored in a particular format?  You can always change the output format in your SELECT stmt to capture your date value in any form you need.  (or use a mask on a form if that makes more sense).  Use CONVERT if you need it as a string, or just use DATEPART(dd, TheDateField) ||'/'|| DATEPART(mm, TheDateField) ||'/'|| DATEPART(yyyy, TheDateField) to fo...

Web resources about - How to get todays date in format YY/MM/DD and to compare it to another date passed into the sql - asp.net.sql-datasource

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

How Do Fans Of The New York Giants, Jets Compare On Facebook?
The National Football League ’s New York Giants and New York Jets may share MetLife Stadium in East Rutherford, N.J., but there is no love lost ...

Skyscanner - Compare Cheap Flights (no ads) on the App Store on iTunes
Get Skyscanner - Compare Cheap Flights (no ads) on the App Store. See screenshots and ratings, and read customer reviews.

Apples & Oranges - They Don't Compare - Flickr - Photo Sharing!
I tried comparing apples to oranges... I don't see much resemblance at all! Image Notes: No post production done except Crop &amp; Resize The ...

Bryan Fischer Compares Gay Marriage Ruling To 9/11, Slavery, Pearl Harbor, & Sodom And Gomorrah - YouTube ...
http://www.rightwingwatch.org/content/bryan-fischer-compares-gay-marriage-ruling-911-slavery-pearl-harbor-and-sodom-and-gomorrah Right Wing Watch ...

Bieber compares minor Ferrari crash to Princess Diana's death
New York Daily News Bieber compares minor Ferrari crash to Princess Diana's death 9news.com.au 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 ...

Judge compares incest and paedophilia to past attitudes towards homosexuality, claiming they might not ...
A Sydney judge has compared incest and paedophilia to homosexuality, saying the community may no longer see sexual contact between siblings and ...

Abby Bishop shoulders Canberra's final hopes, but don't compare her to Lauren Jackson
Abby Bishop's sparkling WNBL form is set to lift the Canberra Capitals into the play-offs, but coach Carrie Graf says it's unfair to compare ...

Sheikh Nimr al-Nimr executed: Iran compares Saudi Arabia to ISIS
ANGRY crowds protesting at Saudi Arabia’s execution of a top Shiite cleric have hurled petrol bombs and stormed the kingdom’s embassy in Tehran, ...

Resources last updated: 1/15/2016 7:06:17 AM