|Related to : Ruby on Rails retrieve datetime by converting it from UTC to user's time zone from database by querying date|
|Trying to retrieve data from database then pass to html in Rails's view|
I'm just trying to answer this question because when I started out
with Rails no one helped me. Everyone just said google it.
All the examples where good but I wasn't able to figure the stuff out
and connect the important things.
Your Rails app is most likely a RESTful application.
That means let's say you got a products_controller.rb.
Then you could access them like so:
# all products
|Trouble converting VARCHAR to DATETIME in SQL (with timezone)|
Since it's a string with a timezone in it, you need to convert it to a
SELECT CONVERT(DATETIMEOFFSET, '2014-07-14T10:00:00.000-08:00', 127)
(No column name)
2014-07-14 10:00:00.0000000 -08:00
This works just fine. Once you have that, you can then convert it to a
local DATETIME as needed, e.g. with
DECLARE @DateTimeOffset DATETIMEOFFSET
|Using DateTime to get the GetLastWriteTime of a file, from any cultural format, and then converting it to yyyy/MM/dd|
It would have been better if you could pass DateTime object to your
EXE, but it seems you want to pass Dates as string to your exe and
that too in particular format of yyyy/MM/dd. Use:
stopDate.Text = fileDate.ToString("yyyy/MM/dd",
This will always give you a date string in same format irrespective of
culture. Use the same for other date:
startDate.Text = fiveDa
|Datetime will not update in database|
Your bind_param must be:
Pointed out by Abhik Chakraborty in the comments section.
|Wrong datetime is stored in database|
I'm not familiar with mysqli (I actually use PDO) but maybe you should
verify if your database has default values for you date fields.
Also, if I'm not wrong, you shoud use double quotes in your query.
Finally, you should take care about SQL Injection
(wikipedia.org/wiki/SQL_injection). You're query may be vulnerable.