Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 07-01-2005, 02:09 AM   #1
Member (10 bit)
 
Designer's Avatar
 
Join Date: Mar 2004
Location: Essex, UK
Posts: 982
Send a message via AIM to Designer Send a message via MSN to Designer
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
Designer is offline   Reply With Quote
Old 07-01-2005, 06:46 AM   #2
Member (8 bit)
 
rcvalencia9's Avatar
 
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.
rcvalencia9 is offline   Reply With Quote
Old 07-03-2005, 05:09 AM   #3
Member (10 bit)
 
Designer's Avatar
 
Join Date: Mar 2004
Location: Essex, UK
Posts: 982
Send a message via AIM to Designer Send a message via MSN to Designer
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?
Designer is offline   Reply With Quote
Old 07-03-2005, 09:47 AM   #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.
__________________
WhatsThisBoxFor? is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 04:52 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2