date conversion 2018-03-27 to 2018 Mar 27

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

date conversion 2018-03-27 to 2018 Mar 27

Majid Lotfi
I am doing test using selenium with ruby, I have a web page that has records, one of the columns has dates like 2018 Mar 28 , 

in the search area I have two date pickers from to, when you pick the dates they come like : 2018-03-27 , my question, how to convert :

2018-03-27 to 2018 Mar 27

OR

2018 Mar 27 to  2018-03-27

Thanks,

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/8ba88944-4510-4ab3-9e6c-5eda96003199%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: date conversion 2018-03-27 to 2018 Mar 27

Hassan Schroeder-2
On Thu, Mar 29, 2018 at 8:16 AM, Majid Lotfi <[hidden email]> wrote:

> in the search area I have two date pickers from to, when you pick the dates
> they come like : 2018-03-27 , my question, how to convert :
>
> 2018-03-27 to 2018 Mar 27

Have you looked at the Date section of the (stdlib) docs?

One approach:

2.5.1 (main):0 > Date.parse("2018-03-27").strftime("%Y %b %d")
=> "2018 Mar 27"

HTH,
--
Hassan Schroeder ------------------------ [hidden email]
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAYVpynDWAK2NMYBGf%3DcWn8ZnX56H0mTweZ0ZCAAo63fQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: date conversion 2018-03-27 to 2018 Mar 27

Majid Lotfi
Thanks Hassan, it works now.

On Thu, Mar 29, 2018 at 2:42 PM, Hassan Schroeder <[hidden email]> wrote:
On Thu, Mar 29, 2018 at 8:16 AM, Majid Lotfi <[hidden email]> wrote:

> in the search area I have two date pickers from to, when you pick the dates
> they come like : 2018-03-27 , my question, how to convert :
>
> 2018-03-27 to 2018 Mar 27

Have you looked at the Date section of the (stdlib) docs?

One approach:

2.5.1 (main):0 > Date.parse("2018-03-27").strftime("%Y %b %d")
=> "2018 Mar 27"

HTH,
--
Hassan Schroeder ------------------------ [hidden email]
twitter: @hassan
Consulting Availability : Silicon Valley or remote

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yAYVpynDWAK2NMYBGf%3DcWn8ZnX56H0mTweZ0ZCAAo63fQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CAK%2Bp6EzZpJj5yh7cCiAWwG4Fno6jbZpEYX_WSYEhMfoHLw%3DsiQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.