Time

Posted by: Bluefire

Time - 09/26/02 02:51 PM

I am building a chat program and I would like to have the time. That the message was sent to appear with the message. Or have the current time appear in the top of the chat window. Any help would be great.
Posted by: Predator

Re: Time - 09/26/02 07:19 PM

a little example of code, you'll understand it right away (very easy)

Code:
dim strTimeRightNow as string 'bleh not important for this one
strTimeRightNow = time 'the variable will contain the time for that moment, it's the same with date and who knows what other ones there are :)
Posted by: BackSlash

Re: Time - 09/28/02 06:51 PM

when i want a clock i found it works well to put a timer on the page and set the interval at one second, then make the code for the interval as follows:

Code:
Text1.Text=DateTime.Time  
that makes the text1 display the current time every time the timer counts up one which is every second. thus you get a clock. also if you use DateTime.Date you can display the date. and these can also be used to change the computers date and time settings.
Posted by: SilentRage

Re: Time - 09/29/02 09:25 PM

That's actually the same thing. I didn't know about the DateTime object before, but it turns out that specifying 'DateTime' isn't necessary.

Text1.Text = DateTime.Time

is just like saying

Text1.Text = Time

However, typing DateTime out is useful in that it shows you all the different methods and properties it supports.
Posted by: BackSlash

Re: Time - 09/30/02 01:34 AM

humm, i didn't know that, saves me some typing next time. thanks
Posted by: BackSlash

Re: Time - 09/30/02 01:39 AM

also, i shouldn't say this without trying it first to make sure i got it right, but i think you can do format(date, "dd mm yy") or something like that, and there is probably one like that for time as well. ask neo, i think he knows it...
Posted by: SilentRage

Re: Time - 09/30/02 03:57 AM

yeah, that one is well used by me. Look up the Format Function. It can do all kinds of things.

Format(Time, "hh:mm:ss AM/PM")
Format(Date, "mm-dd-yyyy")
Format(12.4212, "Currency")