You are here

Error message

  • Deprecated function: Array and string offset access syntax with curly braces is deprecated in include_once() (line 20 of /home/benjfc5/public_html/main/includes/
  • Deprecated function: Unparenthesized `a ? b : c ? d : e` is deprecated. Use either `(a ? b : c) ? d : e` or `a ? b : (c ? d : e)` in include_once() (line 1387 of /home/benjfc5/public_html/main/includes/
  • Deprecated function: implode(): Passing glue string after array is deprecated. Swap the parameters in drupal_get_feeds() (line 394 of /home/benjfc5/public_html/main/includes/

Javascript Date is One Day Off

In JavaScript, dates are based on the UTC time, the starting timezone which all others are based on. You may have a date in JavaScript that should be one particular date but for some reason changes itself to the previous day. The way to fix it is to add the timezone offset to the date. Here's an example:

jsfiddle example:

To be more specific, what is happening is the date defaults to a time of midnight, so 5/1/2019 is actually 5/1/2019 12:00:00 AM

If you subtract a few hours (four, in my case) because you're in a timezone that is not the UTC+0 timezone, the date becomes 4/30/2019 08:00:00 PM. If you're only displaying the date and not the time, you'll see 4/30/2019. It probably won't be obvious when you see it. All you see is that your date is off by a day. Well, now you know why.

This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
3 + 14 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.

Theme by Danetsoft and Danang Probo Sayekti inspired by Maksimer