How to get the date of a post in WordPress, so I could use it in a script?

get_the_date and/or get_the_time will return the date/time of the post rather than printing it.

error code: 523