Our Community is getting an upgrade! To get everything ready for the relaunch, we’ll be placing the site in read-only mode starting September 21st.
We really appreciate your understanding while we get things set up behind the scenes. Catch up on all the exciting details about the move here.
Need help or have questions? Drop us a line at [email protected]
Created 09-12-2016 11:31 AM
Created 09-12-2016 04:22 PM
you have to specify MM for the month. 'mm' is for the minutes.
Created 09-12-2016 01:15 PM
@Mayank Pandey there are some ways of converting the date. For example something like select inp_dt, from_unixtime(unix_timestamp(substr(inp_dt,0,11),'dd-MMM-yyyy')) as todateformat from table;
There are several ways to attempt this if you do a google search on your needs.
Created 09-12-2016 02:32 PM
Hi @Ian Roberts,
I tried the following query which you have suggested but I'm getting very different and weird date.
Select log_source_time, from_unixtime(unix_timestamp((test_date),'mm/dd/yyyy hh:mm:ss a'),'yyyy-mm-dd hh:mm:ss a') as todateformat from table1 limit 2;
| log_source_time | todateformat |
| 9/1/2016 11:31:21 AM | 2016-31-01 11:31:21 AM |
| 9/2/2016 9:59:59 AM | 2016-59-02 09:59:59 AM |
Created 09-12-2016 02:42 PM
@Mayank Pandey what does the following produce?
select log_source_time, from_unixtime(unix_timestamp(substr(log_source_time,0,11),'dd-MMM-yyyy')) as todateformat from table1 limit 2;
Created 09-12-2016 02:47 PM
@Ian Roberts the above query gave the todateformat output as NULL.
Created 09-12-2016 03:14 PM
oops, your input is slashes, not dashes. Can you try with the needed format?
Created 09-12-2016 04:22 PM
you have to specify MM for the month. 'mm' is for the minutes.
Created 09-13-2016 05:25 AM
@njayakumar the solution provided by you has worked. Thank a ton 🙂