egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

12 hr > 24 hr clock

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help
View previous topic :: View next topic  
Author Message
NewzNZ
Voice


Joined: 05 Mar 2009
Posts: 35

PostPosted: Fri Jan 12, 2018 8:24 pm    Post subject: 12 hr > 24 hr clock Reply with quote

Hi all

I have a weather script that pulls data from a site to post.
It displays the time in 12 format - just wondering if there's a way to convert that to display in 24 hour format?

eg 2:35pm becomes 14:35

Thanks in advance!
_________________
24:7 REALTIME NEWS + MARKET ACTION
http://iNewsroom.live
#Newsroom @ Rizon
Back to top
View user's profile Send private message Visit poster's website
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 546
Location: Tennessee, USA

PostPosted: Fri Jan 12, 2018 11:58 pm    Post subject: Reply with quote

Try this maybe...
Code:
set time24 [clock format [clock scan "2:35 pm" -format "%I:%M %p"] -format "%H:%M"]

_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
Back to top
View user's profile Send private message Visit poster's website
NewzNZ
Voice


Joined: 05 Mar 2009
Posts: 35

PostPosted: Sat Jan 13, 2018 12:01 am    Post subject: Reply with quote

Great - thanks for the reply SpiKe^^.

Do you know if there's a way with that code to turn any 12hr time format into 24hr? Maybe with wildcards?

Cheers again.
_________________
24:7 REALTIME NEWS + MARKET ACTION
http://iNewsroom.live
#Newsroom @ Rizon
Back to top
View user's profile Send private message Visit poster's website
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 546
Location: Tennessee, USA

PostPosted: Sat Jan 13, 2018 12:23 am    Post subject: Reply with quote

Lol, That time string "2:35 pm" could be the variable holding that time value you need converted:)

Code:
set sometime "2:35 pm"
set time24 [clock format [clock scan $sometime -format "%I:%M %p"] -format "%H:%M"]


The exact way you might fit that into someone's script would be a little different for every script.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
Back to top
View user's profile Send private message Visit poster's website
NewzNZ
Voice


Joined: 05 Mar 2009
Posts: 35

PostPosted: Sat Jan 13, 2018 12:42 am    Post subject: Reply with quote

Thanks! Will give that a go! =)
_________________
24:7 REALTIME NEWS + MARKET ACTION
http://iNewsroom.live
#Newsroom @ Rizon
Back to top
View user's profile Send private message Visit poster's website
SpiKe^^
Owner


Joined: 12 May 2006
Posts: 546
Location: Tennessee, USA

PostPosted: Sat Jan 13, 2018 12:48 am    Post subject: Reply with quote

Goodluck.

If ya need more help, post the weather script here.
_________________
SpiKe^^

Get BogusTrivia 2.06.4.7 at www.mytclscripts.com
Back to top
View user's profile Send private message Visit poster's website
NewzNZ
Voice


Joined: 05 Mar 2009
Posts: 35

PostPosted: Sat Jan 13, 2018 12:53 am    Post subject: Reply with quote

Will do! Thanks =)
_________________
24:7 REALTIME NEWS + MARKET ACTION
http://iNewsroom.live
#Newsroom @ Rizon
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Scripting Help All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber