top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Normalize dates those are entered in more then one way in rails

+1 vote
347 views

I'm looking for a function, gem, etc. that will help to unify dates as they come in different formats. If the date comes in (1/2/2012,2012-01-02,01-02-2012,20120102,01022012, etc.)

it would be nice to have it come out 2012-01-02. I've searched for a few days and only find ways to convert this format to that format. I might be using the wrong search terms and this may have already been addressed, if so, I apologize. In my previous PERL app I wrote a long If Else type converter that would test the date and then convert it in a specific order but I'm sure someone has solved it better then I could.

posted Jul 19, 2013 by anonymous

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button
Where are the dates coming from?

Similar Questions
0 votes

I am proposing to have multiple domain name pointing towards a single site. On the site I would like to display the domains name that was used. How can I obtain the name of the domain that the user entered to access my site?

+1 vote

Anyone can help me figure out why the blogit gem dates posts a month ahead of today?

+2 votes

I am working on building an api client for the Rakuten Market-place. I have got some test requests for add delete update etc working and thought I should aim to structure it as a Gem and publish it so that others can use it/enhance it.

I haven't built a Gem before (worked mostly within the rails environment to date).

Have been reading and looking at other api client gems and am making progress on building something (still got a way to go to handle errors etc.)

To make the gem general purpose though, I am trying to figure out the best way to provide the mapping between models in a rails app and the api client objects (such as product, category, order etc).

I am aiming to make each client api object a class be (or should i call them models?)
Then I suspect I will use new to build an api instance from a rails instance, and find to return an api instance to a rails instance.

I can build in mapping for my own models to the api objects with no problem, but I can't see how I could generalize this so that other apps with similar models could use the gem.

I suspect there are approaches for doing this, but so far I haven't managed to come up with how to do it. If anyone has any wisdom on the matter I would be grateful.

...