score:0
You can use Activesupport String#in_time_zone
in_time_zone(zone = ::Time.zone)Link Converts String to a TimeWithZone in the current zone if Time.zone or Time.zone_default is set, otherwise converts String to a Time via String#to_time
score:2
In Rails you can convert a properly formatted string to milliseconds with:
"2014-06-16 16:00:00".to_datetime.strftime('%Q')
score:14
You need to covert sstring to dateTime as the first, Use this code:
DateTime.parse("2011-05-19 10:30:14").strftime('%Q')
Or this code:
"2014-06-16 16:00:00".to_datetime.strftime('%Q')
So you can convert array of strings of dates as the following:
dates.map!{|d| d.to_datetime.strftime('%Q')}
Source: stackoverflow.com
Related Query
- Converting String to Datetime Rails
- How to convert datetime string to UTC to plot points on Highcharts
- How to convert datetime string to UTC to plot points on Highcharts
- Rails - convert date string into javascript date object for highcharts
- Exception when converting to image from Base-64 string
- Converting String value to int to be used within highchart
- Strange character in the Highstock source code
- Converting DateTime to EPOCH time is returning a new Date
- Using highcharts for Rails (via LazyHighCharts), is there a tooltip for yDateFormat for having datetime data on the Yaxis?
- Rails + PostgreSQL group data hourly with datetime
- Highcharts DateTime Localization
- customize highcharts tooltip to show datetime
- X-axis category name from string in series list
- Highcharts datetime axis, how to disable time part (show only dates)?
- highcharts datetime x-axis custom formatting
- Highcharts, Show specific tick on a datetime xaxis type
- HighCharts show datetime format on xAxis
- Highcharts - remove times between dates on a datetime xaxis type
- Optimize JavaScript DrillDown code
- Highcharts max interval for dateTime in x-axis?
- How to show all values at datetime axis in highcharts?
- Convert from string with milliseconds to date object Javascript
- Highstocks - Use tickmarkPlacement "between" on datetime Axis (no categories)
- How to remove weekend datetime gaps from x-axis of a financial chart?
- Highcharts - with datetime axis labels overlap
- getting error#17 from highcharts while using solid gauge from backbone rails
- Converting svg from Highcharts data into data points
- Highchart show string on x-axis
- Replacing highcharts.each in my code as it is being deprecated
- Highcharts - show every month on datetime x-axis when the parent container is small
More Query from same tag
- Highstock - Comparison chart doesn't start at 0%
- Data and tooltip not working for graph using highcharts
- Highcharts, how to put markers on min/max values on yAxis
- how to apply tooltip formatter in charts module drupal
- Unable to customize the box to short single line in 'boxplot' type Highcharts
- How to set scrollbar in highchart tooltip?
- highchart connect nulls only when two values are close (aka by distance)
- ChartJS/High Charts Radar chart - Different radial axis labels for each category that appear on hover
- How to hide specific dots and labels onmouseover in highcharts
- How to allow multiple point selections in Highcharts donut chart?
- How i can increase size of legends in line Highchart
- Unknown Text Shadow (Highcharts)
- highchart datalabel one value is missing in label
- How can i use double click in Highcharts and get that data
- Javascript Highcharts High buttons and calender with jquery
- Highchart's error : Uncaught SyntaxError: Unexpected token for
- Dynamically creating mutiple Highcharts charts in Angular directive
- Highchart zoom feature is not working. It is in https://jsfiddle.net/f0n31uqx/
- Heatmap yAxis change does not work as expected
- A chart in the tooltip is not being fully rendered
- Benchmarking HighCharts, D3 and Canvas plotting
- threshold weirdness in latest highcharts version
- How filter json data with date from datepicker Angular2 app
- highcharts donut pie - different color for the data than its drilldown
- Percentage in hctreemap2 of Highcharter using tooltip?
- HighCharts offline-exporting module not working
- Formating my json for highcharts
- HighCharts: 3D Column Chart change borderColor on select
- How to Export JavaScript Chart to Excel file (HighCharts)
- Can I have multiple plotlines with Highcharts?