Working with Dates


#1

Hello,

This is my first time posting here, hopefully this is a simple question with a simple solution.

We’ve got an event we do every Wednesday and would like to send out reminders leading up to the event.

I’ve read the info on how timestamps should be formatted but I’m still having issues.

I’m pretty sure I’m generating the proper timestamp but when I pull the contact up, the data for the date field displays as “1/18/1970”.

Has anyone else out there run into this issue, should I be using a different field?

Here is the initial string I generate with PHPs “date” function “2017-05-17 00:00:00 UTC” and here is the time stamp I get after converting that string “1494979200” using “strtotime”.

I’m more than happy to share the code that is generating the strings if it helps and thanks in advance if someone out there can help me with this, it would be very much appreciated.

Thanks!


#2

Hi @osmarketingdev

PHP’s strtotime returns its value in seconds, so you’d just need to multiply that by 1000 to get the millisecond value that HubSpot uses.


#3

Awesome and thanks! I knew it had to be something small I was overlooking, don’t have to work with dates too often so this was great, got to learn a little more about PHP & HubSpot!