PC Clock

Whats the best way to call and display the system clock as a string e.g. "Twenty Past Four"

I basically want to take the variable from the system clock, and use that in my application to display the time, but in alpha-numeric characters which would be everyday phrases like: "Five minutes past six" "Half past three" etc...

So if someone could show me how to call the system clock into my application, and then convert that into the above type of display, that would be great.


Answer this question

PC Clock

  • azioc

    Well theres a way to do it, to break it right down, what i basically need to know, is 'how can i get the value from the system clock '

    I cant remember how to do it though. Any ideas

  • hotbass

    this is vb.net thats mean you're a noob

    I think he means

    dim henk as string

    henk= time

    msgbox henk



  • HenryC

    try My.Computer.Clock.LocalTime

    Public Class Form1

    Sub foo()

    My.Computer.Clock.LocalTime

    End Sub

    End Class



  • Charlese

    now.toString will give you something like "08/05/2006 15:37:44"

    If you really need "twenty past four" you need to do something like...
    ###############################
    dim strText as string = ""
    round the minutes to the nearest 5
    if minutes > 30 then
    strText = now.minute & " past " & now.hour
    else
    strText = (60-now.minute) & " to " & dateadd(hour,1,now).hour
    endif







  • Paul Pleasant

    You can also say that "Henk is eeen master" so I want to say that verry much. Becaus if I do that I feel my self a klootzak in the world where every one has a cole name I don't have a henk because I want to do it in the nime

    dim tempvar as integer

    sub henk(interval)

    current = timer

    do while timer-current =<val(interval)

    doevents

    loop

    end sub

    if text1.text = "henk" and text2.text = "henk" then

    henk3

    msgbox "you''re a klootzak"

    do while tempvar<1

    msgbox "henk is een master"

    do events

    tempvar = tempvar +1

    loop

    end sub



  • dcdc

    there's no in-built way to do it, you'll have to do it yourself...



  • PC Clock