|
|||||||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
#1 |
|
Member (10 bit)
|
displaying Time/Date in VB6
hey guys,
not something i've ever tried to do before but how would i display the time & date in an application written in vb6. I want to change a label caption to display the date/time with it refreshing every second from a timer or is there a better way to achieve this? I really would like it to be displayed like: 20:15:43 Friday 1st July 2005 is there a quick way of doing this as i've consulted the books i own and none of them have anything about working with time/date and i've also googled this subject but i'm turning up very little. Any help would be greatly appreciated Thanks
__________________
Intel Core i7 920 2.66GHz | Asus P6T SE| 6GB Corsair ram | XFX Radeon HD 4780 | 2 x 250 Gb Maxtor SATA II (in RAID 0), 1 x 250GB SATA II | Creative XFI soundcard | Coolermaster 650W PSU | ThermalTake Tsunami case My new website -Carp Fishing Forums |
|
|
|
|
|
#2 |
|
Member (8 bit)
Join Date: Oct 2004
Location: Manila, Philippines
Posts: 221
|
I dont know if you can change the time format in VB6. But the only thing you need to do is to insert a timer and a label in a form. Set the ENABLED property of the timer to TRUE and INTERVAL to 60. Double click the Timer Control and type this code:
Private Sub Timer1_Timer() Label1.Caption = Time + Date End Sub The output will be like this: 7/1/2005 7:45:20 PM Refreshing every second. |
|
|
|
|
|
#3 |
|
Member (10 bit)
|
excellent, thanks mate
![]() is it possible to also display the weekday i.e Friday 23rd January 2005 or does that need a lot of extra work? |
|
|
|
|
|
#4 |
|
PCMech: Saving Lives
Join Date: Apr 2004
Location: England, the United Kingdom
Posts: 1,839
|
In VBScript you can use the formatdatetime function but you will have to see whether it works in VB6.
|
|
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|