Hi All,

Thanks to windy and all
finally i got  the way to do this


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 Time.parse(b).class # return time
puts b.class # return string


puts  Time.parse(b) > Time.parse(v) # return false
puts    b > v  # return true

On Sun, Apr 11, 2010 at 1:51 PM, windy <lyfi2...@sina.com> wrote:

> require 'time'
> Time.parse("10:40 PM") > Time.now # return true
> So you can use '>' method on the Time class directly.
> please see the book 'rubycook' for more info.
>
> 在 Sun, 11 Apr 2010 12:37:40 +0800,Rajiv Nanduani <
> rajivkumarnandv...@gmail.com> 写道:
>
>
>  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 <
>> rajivkumarnandv...@gmail.com> 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 <george.sand...@gmail.com>
>>> wrote:
>>>
>>>  <省略部分>
>
>
>>>
>>>
>>> --
>>> 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: watir-general@googlegroups.com
>
> To unsubscribe, reply using "remove me" as the subject.
>



-- 
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: watir-general@googlegroups.com

Reply via email to