i think problem with comparison it actually comparing betwwen string not in
time i check  with this

puts b.class # returns string
puts v.class # returns string

so now i change this string to time object but i do not no how to do this
please help on this

On Sat, Apr 10, 2010 at 11:56 PM, Rajiv Nanduani <
[email protected]> wrote:

> Hi George ,
>
> its not work when case AM another  and another is PM
>
> require 'time'
> d = "Picks for this day lock at 01:00 PM ET"
>
> v =
> Time.parse((d.slice(/[0-9]{1,2}:[0-9]{1,2}.*(AM|PM)/i)).strip).strftime("%I:%M
> %p")
>
> d = "Picks for this day lock at 09:24 AM ET"
>
> b=
> Time.parse((d.slice(/[0-9]{1,2}:[0-9]{1,2}.*(AM|PM)/i)).strip).strftime("%I:%M
> %p")
>
> puts v < b # returns 'true' while it should be false
>
> On Sun, Apr 11, 2010 at 5:58 AM, George <[email protected]> wrote:
>
>> Hello,
>>
>> I think this should work for you, although I don't think this is
>> specific to Watir:
>>
>> require 'time'
>>
>> a = Time.now.strftime("%I:%M %p")
>> puts a # returns '5:27 PM'
>> x =  Time.parse("10:30 PM").strftime("%I:%M %p")
>> puts x # returns '10:30 PM'
>>
>> puts a < x # returns 'true'
>>
>>
>>
>> On Apr 10, 10:47 am, Rajiv Nanduani <[email protected]>
>> wrote:
>> > Hi All,.
>> >
>> > I am having a problem i need to check a validation the particular game
>> is
>> > locked after specified time for that i am getting the time as string
>> from
>> > application web page like my string contain s "your game will lock at
>> 10:30
>> > PM IST" now from that string  i will extract out that time in a string
>> like
>> > my variable stringtime = "10:30 PM". after that when my script run then
>> i
>> > have to check time compare with current time for that i am doing this
>> but
>> > this is not work perfect way i think there is need to convert time
>> object
>> > before do comapre.
>> >
>> > # suppose my current time is 10:30 PM means a contain 10:30 PM that is
>> > greater than b but actual result is false
>> > a = Time.now.strftime("%I:%M%p")
>> >
>> > b = "12:40AM"
>> >
>> > puts b
>> > puts a >b
>> >
>> > output is false while i need true
>> >
>> > --
>> > RAJIV KUMAR
>> >
>> > <http://rajivkumarnandvani.wordpress.com/>
>> > <http://learnqtphelp.blogspot.com/>
>>
>> --
>> Before posting, please read http://watir.com/support. In short: search
>> before you ask, be nice.
>>
>> You received this message because you are subscribed to
>> http://groups.google.com/group/watir-general
>> To post: [email protected]
>>
>> To unsubscribe, reply using "remove me" as the subject.
>>
>
>
>
> --
> RAJIV KUMAR
>
> <http://rajivkumarnandvani.wordpress.com/>
> <http://learnqtphelp.blogspot.com/>
>
>
>


-- 
RAJIV KUMAR

<http://rajivkumarnandvani.wordpress.com/>
<http://learnqtphelp.blogspot.com/>

-- 
Before posting, please read http://watir.com/support. In short: search before 
you ask, be nice.

You received this message because you are subscribed to 
http://groups.google.com/group/watir-general
To post: [email protected]

Reply via email to