Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function doConvertAgeToEpoch { # This function converts dates in YYYY-MM-DD_HHMMSS* format to seconds since epoch
- local inputString=$1
- printf " inputString: $inputString"
- local cutStringDate=$(echo $inputString | cut -c -10)
- printf " cutStringDate: $cutStringDate"
- local cutStringTime=$(echo $inputString | cut -c 12-17 ) ## TODO: Why isn't this working?
- printf " cutStringTime: $cutStringTime"
- local cutStringFormatted="${cutStringTime:0:2}:${cutStringTime:2:2}:${cutStringTime:4:2}" # Converts the HHMMSS string into a HH:MM:SS format, which date requires
- local epochString=$(date +%s -d $cutStringFormatted)
- printf " epochString: $epochString"
- }
- doConvertAgeToEpoch 2012-10-15_123456.tar
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement