Hi! Is there an opportunity to convert a string into a date in bash? For example: I have a time format: "%Y-%m-%dS%H:%M:%S"
. An example of such string is "2009-06-24S12:34:56"
. I need to convert this string into a date (unix timestamp) in bash. How can I do this?
views:
1428answers:
1I am on solaris 10. This does not work on it. Sorry, I should have mentioned the OS.date: illegal option -- utcdate: illegal option -- dateusage: date [-u] mmddHHMM[[cc]yy][.SS] date [-u] [+format] date -a [-]sss[.fff]
Markus
2009-08-10 09:37:20
Ah, Solaris. If you do a quick Google search you'll find a lot of people struggling with the same problem: Solaris' date program isn't nearly as powerful as the others out there. You could probably get the same results using Perl or a C program though.
Matthew Iselin
2009-08-10 09:53:20
And Perl should also be available on almost any Solaris box.
Aaron Digulla
2009-08-10 11:06:12