I'm trying to convert a datetime field, which is set to EST, to a UNIX timestamp. But the catch is, the timestamp should be set to midnight UTC.
For example, May 1 2015 would be 1430438400000 (01 May 2015 00:00:00 UTC).
I tried converting first the datetime to UTC, then format it to a 24-hour format, but apparently it didn't work for me. Code below:
UNIX_TIMESTAMP(DATE_FORMAT(DATE(DATE_ADD(rv.created_at,INTERVAL 4 HOUR)),'%Y-%m-%d 00:00:00'))
Can anyone help? Thanks.
UPDATE
I finally got the answer. Putting it here for future reference
FLOOR(UNIX_TIMESTAMP(DATE_SUB(DATE_FORMAT(DATE(rv.created_at),'%Y-%m-%d 00:00:00'),INTERVAL 4 HOUR))*1000)