# FORMULA to change/convert EPOCH time (aka RAW value, i.e. "1631982514") BACK into "YYYY-MM-DD HH:MM:SS" (aka Date and Time)?

**URL:** https://community.mp3tag.de/t/formula-to-change-convert-epoch-time-aka-raw-value-i-e-1631982514-back-into-yyyy-mm-dd-hhss-aka-date-and-time/63377
**Category:** Support
**Created:** [January 10, 2024, 4:15am UTC](https://community.mp3tag.de/t/formula-to-change-convert-epoch-time-aka-raw-value-i-e-1631982514-back-into-yyyy-mm-dd-hhss-aka-date-and-time/63377 "2024-01-10T04:15:43Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![wneclass2018](https://community.mp3tag.de/letter_avatar_proxy/v4/letter/w/cdc98d/32.png) [@wneclass2018](https://community.mp3tag.de/u/wneclass2018)
#### Post date: [January 10, 2024, 4:15am UTC](https://community.mp3tag.de/t/formula-to-change-convert-epoch-time-aka-raw-value-i-e-1631982514-back-into-yyyy-mm-dd-hhss-aka-date-and-time/63377/1 "2024-01-10T04:15:43Z")

</div>

Does anyone have the FORMULA to change/convert EPOCH time (aka RAW value) BACK into "YYYY-MM-DD HH:MM:SS" (I will accept "YYYY-MM-DD", given that hours, minutes, and seconds are easy to manipulate)? I would really APPRECIATE that piece of information to accomplish an action file, making it whole. Likewise, if anyone is interested in converting YYYY-MM-DD HH:MM:SS into Epoch time, check out my SINGLE line string below, as well as further details of my string, even though the placeholders are self-explanatory, via my response in this post: [Convert date and time string into Raw / Epoch time - #8 by wneclass2018](https://community.mp3tag.de/t/convert-date-and-time-string-into-raw-epoch-time/59512/8). Furthermore, concerning converting from EPOCH time to "YYYY-MM-DD HH:MM:SS", I thought I was on the right track, in solving for the year (aka %my\_year%), using this string, "`$cutright($add($div(EPOCH value'00000000',31536000),1970'00000000'),8)`", but it was not 100% reliable.

CONVERT "YYYY-MM-DD HH:MM:SS" to **EPOCH time (My Mp3Tag Formatted string)** [using "$add(A,B,C,D,E,F,'-'G,H)"] (verified results/integers with [https://www.epochconverter.com/](https://www.epochconverter.com/)) ➤➤

> `$add(%my_second%,$mul(%my_minute%,60),$mul(%my_hour%,3600),$mul($add($if($eql(365,$regexp($num(%my_year%,4),'^((?:(?<![\d])(?:(?:[1-9][0-9]{2,}|[0-9]{2})(?:[13579][0-13-57-9]|[02468][1-35-79])|(?:[13579][0-13-57-9]|[02468][1-35-79]|[1-9](?:[0-9]{1,})?(?:[13579][0-13-57-9]|[02468][1-35-79])){1}00){1}(?![\d])){1})$',365)),$sub($regexp($regexp($regexp($regexp($regexp($regexp($regexp($regexp($regexp($regexp($regexp($regexp(%my_month%,'^0*[01]$',0),'^0*2$',31),'^0*3$',59),'^0*4$',90),'^0*5$',120),'^0*6$',151),'^0*7$',181),'^0*8$',212),'^0*9$',243),'^0*10$',273),'^0*11$',304),'^0*12$',334),1),$sub($regexp($regexp($regexp($regexp($regexp($regexp($regexp($regexp($regexp($regexp($regexp($regexp(%my_month%,'^0*[01]$',0),'^0*2$',31),'^0*3$',60),'^0*4$',91),'^0*5$',121),'^0*6$',152),'^0*7$',182),'^0*8$',213),'^0*9$',244),'^0*10$',274),'^0*11$',305),'^0*12$',335),1)),%my_day%),86400),$mul($sub($sub(%my_year%,1900),70),31536000),$mul($div($sub($sub(%my_year%,1900),69),4),86400),'-'$mul($div($sub($sub(%my_year%,1900),1),100),86400),$mul($div($add($sub(%my_year%,1900),299),400),86400))`

CONVERT "YYYY-MM-DD HH:MM:SS" to **EPOCH time (ORIGINAL Formula: [stackoverflow.com](https://stackoverflow.com/questions/7960318/math-to-convert-seconds-since-1970-into-date-and-vice-versa/8020212#8020212))** ➤➤ `tm_sec + tm_min*60 + tm_hour*3600 + tm_yday*86400 + (tm_year-70)*31536000 + ((tm_year-69)/4)*86400 - ((tm_year-1)/100)*86400 + ((tm_year+299)/400)*86400`

---

<div class="post-metadata">

### Author: ![ohrenkino](https://community.mp3tag.de/user_avatar/community.mp3tag.de/ohrenkino/32/4843_2.png) [@ohrenkino](https://community.mp3tag.de/u/ohrenkino)
#### Post date: [January 11, 2024, 8:20am UTC](https://community.mp3tag.de/t/formula-to-change-convert-epoch-time-aka-raw-value-i-e-1631982514-back-into-yyyy-mm-dd-hhss-aka-date-and-time/63377/2 "2024-01-11T08:20:05Z")

</div>

If you do not find anyone to supply an expression in MP3tag, then you could use a CSV-export script that also includes the filename,  
export the raw number and the filename,  
import that CSV into a spreadsheet program,  
calculate the date with one of the ready-made functions in that spreadsheet program,  
export a text file with the results including the filename  
import that data with Convert\>Text file-Tag.

> **[Import Tags from Text Files – Mp3tag Documentation](https://docs.mp3tag.de/converters/import-tags-from-text-files/)**
>
> Documentation on Text File to Tag, a converter to import tags from text files. Mp3tag is the universal Tag Editor.

---

<div class="post-metadata">

### Author: ![system](https://community.mp3tag.de/uploads/default/original/2X/c/ce7035d426cb755a7916793326d23b465222a407.png) [@system](https://community.mp3tag.de/u/system)
#### Post date: [February 9, 2026, 12:30pm UTC](https://community.mp3tag.de/t/formula-to-change-convert-epoch-time-aka-raw-value-i-e-1631982514-back-into-yyyy-mm-dd-hhss-aka-date-and-time/63377/3 "2026-02-09T12:30:13Z")

</div>


