Αποτελέσματα Αναζήτησης
8 Μαρ 2012 · def dateFix(dateLine) dateLine = dateLine.split('-') newDate = dateLine.slice(2), dateLine.slice(0), dateLine.slice(1) newDate = newDate.join('-') end @reg = /\b\d\d-\d\d-\d\d\d\d\b/ File.open('some_file.txt', "r+") { |file| file.each_line { |line| date = line if line == @reg if date file.puts line.gsub(date, dateFix(date)) end } }
11 Ιουλ 2012 · The 3rd field is rewritten by parsing the given date using strptime() with the time format string %d-%b-%Y and then reformatting the resulting Unix timestamp using strftime() and the %F formatting string (you could use, e.g., %Y-%m-%d in place of %F):
Use GNU 'date' for this. It will also convert between other formats for you (see date --help for the list of formats). $ date -d 2013-07-05 +%m/%d/%Y 07/05/2013 $ date -d 07/05/2013 +%F 2013-07-05
26 Οκτ 2016 · sed -i -E 's/([0-9]{4})\.([0-9]{2})\.([0-9]{2})/\1-\2-\3/g' *.txt. Also, if the date is in format DD.MM.YYYY, to change it to YYYY-MM-DD format I used: sed -i -E 's/([0-9]{2})\.([0-9]{2})\.([0-9]{4})/\3-\2-\1/g' *.txt. Share. Improve this answer.
29 Απρ 2017 · It's quite simple with date -d, e.g. while read -r line; do echo $(date -d "$line" +%Y-%m-%d); done < file.txt Input File
For DD-MM-YYYY format, you can replace with \3-\2-\1. Edit: This is a GUI solution. Example using Notepad2: Edit: Some text editors such as Notepad++ and UltraEdit have batch processing features where the above find/replace operation can be applied to many files with just one click.
27 Νοε 2023 · Windows allows you to easily change the format of dates and times, including using periods instead of slashes and customizing the format. To access the date and time format settings in Windows 10, click on the Search box and type "change the date."