i have some set of date data inside csv files and need to convert the timezone,
date format is : %m%d%Y%H%M%Smilisec
input.txt:
i can do manual convert with date command buts its not effective
how to execute date inside awk?
sample input 08302016113630321 add 8 hours to adjust timezone and the output is 08312016003630321
output from sample data above
Last edited by vbe; 09-05-2016 at 08:53 AM..
Reason: more code tags
Could you please try following and let me know if this helps you, though following is not giving miliseconds at last, though I am working on it to get it done. Let me know how it goes then.
Output will be as follows.
Where your Input_file is as follows.
Explanation of above code is if you remove | shafter Input_file then you could see code will execute following commands one by one to shell which it will only print to console once you remove | sh from above code.
Will post update once I am able to get miliseconds too for this solution. EDIT: Adding complete solution with miliseconds part too as follows.
Output will be as follows.
Here wanted to mention previous solution command date --date="2016-08-30 11:36:11.861" +%s%3N was not having %3Npart so it was not able to print miliseconds, now it is. Please do let me know if this helps you or you have any queries on same.
Thanks,
R. Singh
Last edited by RavinderSingh13; 09-05-2016 at 02:16 PM..
Reason: Adding non-one liner forms of solutions now. Added complete solution successfully with GOD's grace now.
This User Gave Thanks to RavinderSingh13 For This Post:
Hi All
I need help in converting a string of YYYYMMDD format to date in Sun OS and then find out if the day is a Wednesday or not. The "date -d" option is not working and your help is much appreciated.
The date command usage from the operating system we use here is as follows:
Thanks,
SK (11 Replies)
Hi,
I have a requirement where I am getting date in string format (20161130). I need to add 20 days(not no. 20) to the above string. The o/p should 20161220.
In case of 20170228, it should show 20170320.
Could you please help me with the command to achieve this.
Note: I am using AIX 7.1... (5 Replies)
Hi,
I am getting the below string as a input for date.
12/03/2013 11:02 AM
I want to change this date as 03-DEC-2013 11:02 AM.
Could you please help on this.
Thanks
Chelladurai (4 Replies)
Hi All,
I want to convert string in format YYYYMMDD(20120607) to date in unix and add 1 day to it and convert back to string in format YYYYMMDD. Please help. (4 Replies)
Hi All,
I have a string like below.
"Mar 31 2009" .
I want to convert this to unix time .
Also please let me know how to find the unix time for the above string minus one day. For Eg. if i have string "Mar 31 2009" i want to find the unix time stamp of "Mar 30 2009".
Thanks in advance,... (11 Replies)
Hi,
I have a String input parameter like this: 20080430 (YYYYMMDD). Inside
my korn shell script I need to add one day to this date.
L_TRADE_DAY=$1
let L_TODAY=$L_TRADE_DAY+1
Offcourse this raises a problem at the end of a month. 20080430 + 1 gives 20080431 instead of 20080501.
... (2 Replies)
Hi guys, i need your help.
I need to convert a date like this one 20071003071023 , to a formated date
like 20071003 07:10:23 .
Could this be possible ?
Regards,
Osramos (6 Replies)