I need to convert a string to date in a specific timezone.
Eg.
from = "June 13, 2015"
Date.strptime(from,"%b %d, %Y") #=> Sat, 13 Jun 2015
Date.strptime(from.strip,"%b %d, %Y").in_time_zone("America/Chicago") #=> Sat, 13 Jun 2015 00:00:00 CDT -05:00 which is ActiveSupport::TimeWithZone format
Date.strptime(from,"%b %d, %Y").in_time_zone("America/Chicago").to_date #=>Sat, 13 Jun 2015 which is in UTC Date class
I need the final date in America/Chicago timezone. How can I achieve that?
I need to achieve a date in the desired timezone and not time in a desired timezone.
Time.now.in_time_zone("Eastern Time (US & Canada)") will give ActiveSupport::TimeWithZone format while I need the date format in desired timezone.