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
If you're using C/C++ (which I somewhat doubt), consult strftime documentation.
is this really bot related, i mean seriously this is like simple string manipulation.
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;
}
That'll return the 12-hour-clock time. If you want a 24-hours clock, use this:
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;
}
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);
void TimeStamp(char *szBuf)
{
SYSTEMTIME st;
GetLocalTime(&st);
sprintf(szBuf, "[%02i:%02i:%02i] ", st.wHour, st.wMinute, st.wSecond);
}
:P
12-hour notation sucks.
Is not 12 hour!
How about 24 hr timestamps is vb?
My second one is 24 hour
Format(Time, "hh:mm:ss")
Would I be correct in saying that I would need a timer to add onto Format(Time, "hh:mm:ss") so it changes?
For 24-hour time, use:
Format(Time, "HH:mm:ss")
I mean for a clock......
-1 to Lenny. Stop asking the same question over and over and not reading the answers you get.
!~!HaZaRD!~!
I havent been asking the same question...Im asking how would you make a clock not a TIMESTAMP
Quote from: Lenny on July 03, 2003, 03:47 PM
I havent been asking the same question...Im asking how would you make a clock not a TIMESTAMP
See that has nothing to do with VB, go buy some hardware tools and "Make" your "Clock".
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 from: Lenny on July 03, 2003, 11:05 PM
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
#1 for Lenny, Yes I was joking.
#2 for DarkMinion, its something called a "joke".
Lenny, a clock is simply a timestamp that updates itself. Use a timer.
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.
Thank you.....
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
use the ez way :) uses your windos time :)
rtbAdd " [" & time & "]" & " or w/e u want here! "