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

To unsubscribe, reply using "remove me" as the subject.

Reply via email to