Valhalla Legends Forums Archive | Battle.net Bot Development | How do you add the time? [TT:TT:TTAM]

AuthorMessageTime
PsYcHiC
How do you make those in front of the text you send? I mean the right time, not the [HH:MM:SS] like [03:23:53 AM]? Any help would be appreciated.

HH = Hours
MM = Minutes
SS = Seconds
July 1, 2003, 4:44 PM
Kp
If you're using C/C++ (which I somewhat doubt), consult strftime documentation.
July 1, 2003, 6:36 PM
c0ol
is this really bot related, i mean seriously this is like simple string manipulation.
July 1, 2003, 7:07 PM
iago
[code]char *GetTime(char Buffer[12])
{
   // Get the time:
   long currtime = time(NULL);
   tm *Time = localtime(&currtime);
   sprintf(Buffer, "%02d:%02d:%02d%s", (Time->tm_hour <= 12) ? Time->tm_hour : (Time->tm_hour - 12), Time->tm_min, Time->tm_sec, Time->tm_hour > 12 ? "PM" : "AM");

   return Buffer;
}[/code]

That'll return the 12-hour-clock time. If you want a 24-hours clock, use this:
[code]char *GetTime(char Buffer[10])
{
   // Get the time:
   long currtime = time(NULL);
   tm *Time = localtime(&currtime);
   sprintf(Buffer, "%02d:%02d:%02d", Time->tm_hour, Time->tm_min, Time->tm_sec);

   return Buffer;
}[/code]

And to use these, just use a sprintf to get it into a buffer
char TimeBuf[12];
sprintf("%s <%s> %s\n", GetTime(TimeBuf), sender, message);
July 1, 2003, 7:48 PM
DarkMinion
[code]
void TimeStamp(char *szBuf)
{
   SYSTEMTIME st;
   GetLocalTime(&st);
   sprintf(szBuf, "[%02i:%02i:%02i] ", st.wHour, st.wMinute, st.wSecond);
}
[/code]

:P
July 1, 2003, 9:21 PM
Yoni
12-hour notation sucks.
July 1, 2003, 10:10 PM
DarkMinion
Is not 12 hour!
July 2, 2003, 12:29 AM
Lenny
How about 24 hr timestamps is vb?
July 2, 2003, 4:16 AM
iago
My second one is 24 hour
July 2, 2003, 4:26 AM
UserLoser
Format(Time, "hh:mm:ss")
July 2, 2003, 4:36 AM
Lenny
Would I be correct in saying that I would need a timer to add onto Format(Time, "hh:mm:ss") so it changes?
July 2, 2003, 5:07 AM
Grok
For 24-hour time, use:

[code]Format(Time, "HH:mm:ss")[/code]
July 2, 2003, 11:13 AM
Lenny
I mean for a clock......
July 3, 2003, 4:23 AM
DrivE
-1 to Lenny. Stop asking the same question over and over and not reading the answers you get.

!~!HaZaRD!~!
July 3, 2003, 12:50 PM
Lenny
I havent been asking the same question...Im asking how would you make a clock not a TIMESTAMP
July 3, 2003, 8:47 PM
PsYcHiC
[quote author=Lenny link=board=17;threadid=1761;start=0#msg13751 date=1057265252]
I havent been asking the same question...Im asking how would you make a clock not a TIMESTAMP
[/quote]
See that has nothing to do with VB, go buy some hardware tools and "Make" your "Clock".
July 4, 2003, 3:48 AM
Lenny
PsYcHiC, I really hope that you are joking........especially since you started the thread.....

Once again back to the subject.......Exactly how would I make a clock in visual basic (example: The thing that most people have in the bottom right corner of the screen)

I hope my question is clear enough now
July 4, 2003, 4:05 AM
PsYcHiC
[quote author=Lenny link=board=17;threadid=1761;start=15#msg13797 date=1057291524]
PsYcHiC, I really hope that you are joking........especially since you started the thread.....

Once again back to the subject.......Exactly how would I make a clock in visual basic (example: The thing that most people have in the bottom right corner of the screen)

I hope my question is clear enough now

[/quote]
#1 for Lenny, Yes I was joking.
#2 for DarkMinion, its something called a "joke".
July 4, 2003, 4:16 AM
Camel
Lenny, a clock is simply a timestamp that updates itself. Use a timer.
July 4, 2003, 6:53 AM
Grok
On the Visual Basic menu, choose Project | Components (Control-T). Check the box for "Microsoft Windows Common Controls 6.0 (SP4)" and click OK.

In the toolbox, double-click a status bar icon. Right click the new status bar and choose properties. On the "Panels" tab, change the Style property to "5-sbrTime" and click OK.

Run the project. The time will be displayed on the form's status bar.
July 4, 2003, 8:01 AM
Lenny
Thank you.....
July 5, 2003, 12:56 AM
gosu
this might be kinda late but you can have a timer and a label or textbox. within the timer, put label1.caption = time or text1.text = time

and if you want date just replace time with date
July 9, 2003, 2:49 AM
blinkdude
use the ez way :) uses your windos time :)

[code]
rtbAdd " [" & time & "]" & " or w/e u want here! "
[/code]
July 11, 2003, 9:29 PM

Search