Utilizing the Yahoo API on my server to retrieve currency information can be done through this link: Yahoo Currency API
This API provides me with both a Date
and a Time
, which I'd like to combine into a single DateTime
object. This will allow me to easily convert it to the local time for clients.
To achieve this, I initially used the following code:
DateTime combinedDateTime = dateOnly.Add(timeOnly.TimeOfDay);
Now, my goal is to convert this combined DateTime to the client's local time using JavaScript.
I attempted to do this on the client side with the following code snippet:
var d = new Date(d + " UTC");
alert(d.toString());
Update: The value of 'd' is 2015-04-06T12:32:00
.
However, upon testing this code, I encountered an error stating 'Invalid Date'.