473,396 Members | 1,754 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Find Today? Date Using Code

Hi, I?m programming a web app using c# and asp.net and I am trying to
display a list of performances that are scheduled in the next month, in a
listbox. So I need to get today?s date in my code and compare it to the
dates of all the concerts and display the appropriate ones. My main problem
is getting today?s date can anyone help.
Thanks in advance
Tadhg88

--
Message posted via http://www.dotnetmonster.com
Nov 16 '05 #1
5 11624
DateTime now = DateTime.Now;
--
Saludos,

Bela Istok
"Tim Whelan via DotNetMonster.com" <fo***@DotNetMonster.com> wrote in
message news:a3******************************@DotNetMonste r.com...
Hi, I?m programming a web app using c# and asp.net and I am trying to
display a list of performances that are scheduled in the next month, in a
listbox. So I need to get today?s date in my code and compare it to the
dates of all the concerts and display the appropriate ones. My main problem is getting today?s date can anyone help.
Thanks in advance
Tadhg88

--
Message posted via http://www.dotnetmonster.com

Nov 16 '05 #2
I would also like to add that it would be best to pass in a start date
and end date to a stored procedure and have your SQL do the compare in
the WHERE clause instead of returning all the rows and comparing in c#
code.

Best regards,
Jeffrey Palermo

Nov 16 '05 #3
"Bela Istok" <be****@hotmail.com> wrote in news:erH##$BGFHA.3888
@TK2MSFTNGP12.phx.gbl:
DateTime now = DateTime.Now;


That includes the time too, to just get today use:
DateTime xToday = DateTime.Now.Date;
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/
Nov 16 '05 #4
Or DateTime.Today

Regards

Richard Blewett - DevelopMentor
http://www.dotnetconsult.co.uk/weblog
http://www.dotnetconsult.co.uk

nntp://news.microsoft.com/microsoft.public.dotnet.languages.csharp/<Xn******************@127.0.0.1>

"Bela Istok" <be****@hotmail.com> wrote in news:erH##$BGFHA.3888
@TK2MSFTNGP12.phx.gbl:
DateTime now = DateTime.Now;


That includes the time too, to just get today use:
DateTime xToday = DateTime.Now.Date;
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Develop ASP.NET applications easier and in less time:
http://www.atozed.com/IntraWeb/

--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.300 / Virus Database: 266.3.0 - Release Date: 21/02/2005

[microsoft.public.dotnet.languages.csharp]
Nov 16 '05 #5
"Richard Blewett [DevelopMentor]" <ri******@NOSPAMdevelop.com> wrote in
news:uQ**************@TK2MSFTNGP12.phx.gbl:
Or DateTime.Today


Even better. :)
--
Chad Z. Hower (a.k.a. Kudzu) - http://www.hower.org/Kudzu/
"Programming is an art form that fights back"

Empower ASP.NET with IntraWeb
http://www.atozed.com/IntraWeb/
Nov 16 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Phil Powell | last post by:
The date field I believe is of type datetime, but I'm sorry I have absolutely no idea how to put today's date into a datetime column using ASP and SQL Server. Folks, I'm a LINUX guy!!! This is a...
7
by: Vinnie Davidson | last post by:
Hello! I'm trying to get all records from my SQL Server Database with "DeadlineDate" = today (not today - 24 hours). All records has a field called "DeadlineDate", and the date is stored in...
5
by: Janet Chapman | last post by:
I am creating a database for a video shop and in the loans table want there to be a field for date taken, with a default value of today. Trying to write =today() as in the help gives an error,...
10
by: purkka | last post by:
Hi I did not find any solution from Internet how to do it. There is a lot of samples how to retrieve day of the week, but not number of the week. With rgds MP
2
by: Richard | last post by:
I have a textbox and an HtmlInputButton control on a Webform for an Intranet app. When the user clicks the button, it is supposed to add today's date to the textbox using JavaScript on the client...
3
by: Peter | last post by:
Has anyone written any code to find the date of every other Friday of the year? Is there an easy way of doing this?
2
by: tshad | last post by:
I am trying to check the date of my field to check if it is greater that today, but I am getting an error. I am using : <asp:CompareValidator runat="server"...
23
by: thebjorn | last post by:
For the purpose of finding someone's age I was looking for a way to find how the difference in years between two dates, so I could do something like: age = (date.today() - born).year but that...
5
by: M Skabialka | last post by:
I am creating my first Visual Studio project, an inventory database. I have created a form and used written directions to add data from a table to the form using table adapters, data sets, etc. ...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.