In case your JPG files have EXIF data stored this can easily be accomplished with
Command line tool to manipulate EXIF data, and to touch the timestamp or rename a jpg file according to the EXIF data stored within the file.
jhead -ft unnamed.jpg # to touch the time
jhead -n%Y%m%d-%H%M%S unnamed.jpg # to rename in this format YYYYMMDD-hhmmss
Another, similar tool will also manipulate and use EXIf data from other file fomats including:
Supported formats are JPEG, TIFF, PNG, JP2, Adobe DNG, Canon CRW, Canon THM, Nikon NEF, Pentax PEF and XMP sidecar files. Read-only support is currently available for PSD and several TIFF-based RAW formats: Canon CR2, Fujifilm RAF, Minolta MRW, Olympus ORF, Sony ARW and Sony SR2. Manpage exiv2
exiv2 rename unnamed.jpg # will rename to YYYYMMDD_hhmmss.jpg
Shotwell Photo Manager is installed by default and can sort images according to their EXIF data: