473,322 Members | 1,806 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,322 software developers and data experts.

Display current date

I'm very new to Visual C# .NET and would appreciate any help. I am using
Visual Studio .NET 2003. I want to display the current date from the user
system in a web form. I have spent hours searching for help using google but
with no success. It was recommended I display the date using a label but
cannot seem to create the correct code. Can someone help me?

Thank You
Nov 17 '05 #1
4 32049
label1.Text = DateTime.Now.ToString();

"Bill Burke" <Bill Bu***@discussions.microsoft.com> wrote in message
news:D1**********************************@microsof t.com...
I'm very new to Visual C# .NET and would appreciate any help. I am using
Visual Studio .NET 2003. I want to display the current date from the user
system in a web form. I have spent hours searching for help using google but with no success. It was recommended I display the date using a label but
cannot seem to create the correct code. Can someone help me?

Thank You

Nov 17 '05 #2
Is this correct?
public class cert : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
private void LoadInfo()
{
this.Label1.Text = DateTime.Now.ToString();
}

"Bill Burke" wrote:
I'm very new to Visual C# .NET and would appreciate any help. I am using
Visual Studio .NET 2003. I want to display the current date from the user
system in a web form. I have spent hours searching for help using google but
with no success. It was recommended I display the date using a label but
cannot seem to create the correct code. Can someone help me?

Thank You

Nov 17 '05 #3
working now, thank you for your help

"Bill Burke" wrote:
Is this correct?
public class cert : System.Web.UI.Page
{
protected System.Web.UI.WebControls.Label Label1;

private void Page_Load(object sender, System.EventArgs e)
{
// Put user code to initialize the page here
}
private void LoadInfo()
{
this.Label1.Text = DateTime.Now.ToString();
}

"Bill Burke" wrote:
I'm very new to Visual C# .NET and would appreciate any help. I am using
Visual Studio .NET 2003. I want to display the current date from the user
system in a web form. I have spent hours searching for help using google but
with no success. It was recommended I display the date using a label but
cannot seem to create the correct code. Can someone help me?

Thank You

Nov 17 '05 #4


This will display date and Time at the label...

How should I do if I only want to display date in a textbox?

Like 5/17/2005 ?
Cheers!

CLaudi

*** Sent via Developersdex http://www.developersdex.com ***
Nov 17 '05 #5

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

Similar topics

2
by: Simon Wigzell | last post by:
My client has an annual calendar of events consisting of a record for each event, key field is the event date saved as a date type field. They would like the display to start with the current...
8
by: Monty | last post by:
Let's say you provide an online service from 7:00AM to 6:00PM Eastern Time (daylight time in the summer). Is there way of showing these hours of availability on a web page in the user's local...
3
by: Kevin Gibbons | last post by:
Hello all, I've browsed through past usenet archives, but can't seem to come across quite the javascript I'm looking for. I'm looking for a simple javascript that will display the date as such:...
34
by: kroger | last post by:
Hi. I am at a loss to decipher why the javascript on my web page: http://www.psych.nmsu.edu/~jkroger/lab/index.html does not display the date correctly in Firefox. Instead of "2005" for the...
17
by: perryche | last post by:
I have 5records, e.g. Rc1, Rc2, Rc3..., when user open up a form, I want it to open to a particular record (say Rc3) then when user chooses the Record Selector , it will go to Rc2 and , it will go...
5
by: Peter Lapic | last post by:
I have to create a image web service that when it receives an imageid parameter it will return a gif image from a file that has been stored on the server. The client will be an asp.net web page...
0
by: remya1000 | last post by:
I need to display current month,last 3months,6months and 1year records seperatly. and first i'm tring to display current month's records. and the error i received is this. Microsoft VBScript...
3
by: remya1000 | last post by:
i'm using ASP with MSAccess as database. i have two buttons and two textbox in my page. when i press my first button (First month) i need to display the current month in one textbox and last one...
2
by: Vbbeginner07 | last post by:
How to display current date in a datepicker where once we have loaded the datepicker onto form it shows current date,but after some days it shows only the date when it was loaded onto the form,please...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.