change one time format to other format
hi.
the time format i have used is %m:%d:%Y:%H:%M:%S eg- 06:21:10:13:29:18 and i want to convert it to 2010-06-21 13:29:18.. thanx for any help... |
you need to actually explaihn where you're doing this... is this in some code? What language is it etc..? We aren't psychic. All we can say is that you should change to date format string you're using and it'll print it out differently.
|
actually i have already a file with the time format %m:%d:%Y:%H:%M:%S eg- 06:21:10:13:29:18 and i want to read the file through shell scripting and change the format to 2010-06-21 13:29:18..
|
Maybe an AWK script like this:
Code:
BEGIN { |
Using the GNU date command you can choose the date format you want - as previously suggested. The problem is that you have to transform the input date in a format recognizable by the -d option (to specify a date other than the current one). For example you may want to change the date string into "06/21/10 13:29:18" by means of shell's parameter substitution:
Code:
$ string="06:21:10:13:29:18" Code:
$ d="06:21:10:13:29:18" |
All times are GMT -5. The time now is 03:40 PM. |