Jump to content

Welcome to Geeks to Go - Register now for FREE

Geeks To Go is a helpful hub, where thousands of volunteer geeks quickly serve friendly answers and support. Check out the forums and get free advice from the experts. Register now to gain access to all of our features, it's FREE and only takes one minute. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more.

Create Account How it Works
Photo

Displaying current date on Visual Basic 6?


  • Please log in to reply

#1
MaverickSidewinder

MaverickSidewinder

    Member

  • Member
  • PipPipPip
  • 257 posts
I would like to make a form that shows date and time. I know how to display the time (ill post the code so if people want to know that they'll know how :)

Code for Displaying time

' Create a form with a timer (interval time set to 500) and a label (default will be Label1)
' Set the label caption to 00:00:00 (those are zeros NOT the letter O)

Private Sub Timer1_Timer()
Label1.Caption = Time
End Sub

Now i would like to know the code to simply display the current date that a user has on the computer on a label..either with numeric values like: 00/00/00 or possibly (i would prefer this) with word values, example:

A label that shows: "Today is the: 1st[it doesn't need to have the "st"] of January 2006

I hope someone knows how to do this and is willing to help me with it :woot:

Maybe it doesn't even exist..but i really doubt it :tazz:

p.s. I put colors on the display so it is easier to see what i would like to display..i know how to color the labels and text :)

Edited by MaverickSidewinder, 11 November 2005 - 02:27 PM.

  • 0

Advertisements


#2
darth_ash

darth_ash

    Member 1K

  • Member
  • PipPipPipPip
  • 1,382 posts
Hi MaverickSidewinder,
Try:
label1.caption=Format(Now, "Long Date")
or
,
label1.caption=Format(Now,"dddd, MMM d yyyy")

  • 0

#3
MaverickSidewinder

MaverickSidewinder

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 257 posts
Does this code have to be put on the Timer1 Pivate Sub?
That's where i put it and none of them work...do i have to add something to the label? (ex. for time i would have to add 00:00:00 or else i wouldn't work..)

Thanks though! :tazz:
  • 0

#4
darth_ash

darth_ash

    Member 1K

  • Member
  • PipPipPipPip
  • 1,382 posts
Put the date code in the form load event, since it will stay static for 24hrs.
For the system time will need to user a timer with an interval of 1000msec (i.e. 1sec)

Edited by darth_ash, 11 November 2005 - 10:39 AM.

  • 0

#5
MaverickSidewinder

MaverickSidewinder

    Member

  • Topic Starter
  • Member
  • PipPipPip
  • 257 posts
3 words :)

1) Thank
2) You
3) Resolved

:tazz:
  • 0






Similar Topics

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

As Featured On:

Microsoft Yahoo BBC MSN PC Magazine Washington Post HP