• Skip to primary navigation
  • Skip to main content
Sal Ferrarello
  • About Sal Ferrarello
  • Speaking
  • Connect
    Mastodon GitHub Twitter (inactive)
You are here: Home / Archives for DateTime

DateTime

JavaScript Unix Timestamp from String in Time Zone

Last updated on February 27, 2022 by Sal Ferrarello

Given a string like “2022-01-01 13:00:00”, which represents a time in the “Europe/Paris” timezone, how can we get the corresponding Unix Timestamp in JavaScript? This problem is sufficiently complex that in my opinion leveraging a third-party library is the best solution.

Filed Under: Dev Tips, Programming, Solution Tagged With: DateTime, JavaScript, time zone

JavaScript get Date in YYYYMMDD Format

Last updated on June 15, 2020 by Sal Ferrarello

Recently, I was working in JavaScript and I need to transform a date into the format YYYYMMDD, this is how I did it.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Computing, Dev Tips, Draft, Programming, Solution Tagged With: DateTime, JavaScript

HubSpot API call fail INVALID_DATE not midnight!

Last updated on May 21, 2019 by Sal Ferrarello

When making a HubSpot API call to update a date picker field, I’m getting a response with “response code 400”, “error INVALID_DATE”, and the message includes “not midnight!”. This is why I’m getting this error and how I fixed this call.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Dev Tips, Draft, Programming, Solution Tagged With: DateTime, HubSpot

PHP Convert to DateTimeImmutable

Last updated on February 25, 2019 by Sal Ferrarello

In PHP 5.5 the DateTimeImmutable class was introduced. Immutable objects are nice in that they can not be modified, which helps reduce the likelihood I make certain types of errors. This is how to ensure the DateTime you’re working with is immutable.

Warning! This is a draft, not a finalized post. See full draft disclosure.

Filed Under: Draft, Programming Tagged With: DateTime, PHP

Copyright © 2023 · Bootstrap4 Genesis on Genesis Framework · WordPress · Log in