Jump to content

simple DateTimeInZone($zone) function?


Recommended Posts

I know that this is an old post, but can someone help me out? I am trying to get this script to work, but I think google changed their page, and it is no longer working right.

Here is the code that I see when I pull the source of the page. Can someone help with the stringregexp part?

<td style="font-size: medium;"><b>22:27</b> Sunday (EDT) - <b>Time</b> in <b>Toronto, ON, Canada</b></td>

I want to extract the time only.

#include <String.au3>
 $String = '<td style="font-size: medium;"><b>22:27</b>  Sunday (EDT) - <b>Time</b> in <b>Toronto, ON,  Canada</b></td>'
 $StringArray = _StringBetween($String, '<b>', '</b>')
 ConsoleWrite($StringArray[0] & @LF)

- Bruce /*somdcomputerguy */  If you change the way you look at things, the things you look at change.

Link to comment
Share on other sites

\d{2}:\d{2} works in regex tester but not in AutoIT. I'll keep trying and see what I come up with.

EDIT:

I'm an idiot >.< Had the wrong flags set on StringRegExp().

\d{1,2}:\d{1,2} will pick out just the time:

$str = '<td style="font-size: medium;"><b>22:27</b> Sunday (EDT) - <b>Time</b> in <b>Toronto, ON, Canada</b></td>'
$regex = '\d{1,2}:\d{1,2}'
$match = StringRegExp($str,$regex,1)
if IsArray($match) Then
   MsgBox(0,"",$match[0])
Else
    MsgBox(0,"","No match")
EndIf
Edited by Foxhound
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...