|
| Joined: Mar 2002 Posts: 9 Junior Member | Junior Member Joined: Mar 2002 Posts: 9 | 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. | | |
▼ Sponsored Links ▼
▲ Sponsored Links ▲
| | | Joined: Mar 2002 Posts: 197 Member | Member Joined: Mar 2002 Posts: 197 | a little example of code, you'll understand it right away (very easy) 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 :)
Never argue with fools... They will only drag you down to their level, and beat you with experience...
| | | | Joined: Mar 2002 Posts: 599 UGN's Resident Homo | UGN's Resident Homo Joined: Mar 2002 Posts: 599 | 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: 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.
"It's better to burn out, than to fade away."
| | | | Joined: Mar 2002 Posts: 1,273 DollarDNS Owner | DollarDNS Owner Joined: Mar 2002 Posts: 1,273 | 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. | | | | Joined: Mar 2002 Posts: 599 UGN's Resident Homo | UGN's Resident Homo Joined: Mar 2002 Posts: 599 | humm, i didn't know that, saves me some typing next time. thanks
"It's better to burn out, than to fade away."
| | | | Joined: Mar 2002 Posts: 599 UGN's Resident Homo | UGN's Resident Homo Joined: Mar 2002 Posts: 599 | 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...
"It's better to burn out, than to fade away."
| | | | Joined: Mar 2002 Posts: 1,273 DollarDNS Owner | DollarDNS Owner Joined: Mar 2002 Posts: 1,273 | 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") | | |
Forums41 Topics33,840 Posts68,858 Members2,176 | Most Online3,253 Jan 13th, 2020 | | | |
|