Generic TimeZone According to login user location - asp.net-mvc-4

I want that all DateTime Objects come from Model may converted to Local of login user. All Datetime are stored in UTC format in Database.
For Example
If someone Create user and CreatedDate is stored in UTC.Now(2014-05-06 01:00PM);
Then someone login from Pakistan and navigate to users view then the DateTime must show as 2014-05-06 06:00PM for last created user.
I know how to convert but which is the best approach to do it. I want to convert all datetime coming from Database into current ..

I saved all My date formats in DateTime.UtcNow
and add 1 column TimeZoneId in DB and check it whenever some results are need to be shown on view or any thing want to manipulate according to timezone of current user.

Related

React Table shows entries based on User Time zone not UTC

I have a table (react/Nodejs) which reads the entries from db and list it in the table. All entries in db are UTC, however depending on the user time zone the table is showing different data. For example in the attached snapshot our week on header is from Sep 19 to Sep 25 but the table shows Sep 26 entry which is outside of the range. That only happens with users on (UTC-xxx) time and not for user on (UTC+xxx). Your help is appreciated? Table Image
Use a timezone library to render it with a specific timezone
The problem is caused when formatting the object to be rendered in the UI, so probably the method you are using is as you say taking into account the users timezone and not a specific one that you set.
To achieve this, you can use a library like moment timezone. Or a variant compatible with your libraries.
Hope it helps.

Problem using java.time.LocalDate as process-variable in jBPM - Business Central

I'd like to use a process-variable to retrieve and store only date, no time information. Therefore I've defined a java.time.LocalDate variable in my process. Then in a taskform, where user should be able to enter a date, I entered a form-control of type DatePicker and unchecked its "show time" property. My problem: the entered date isn't stored in the process-variable. If I check the "show time" property, then the user is being asked for a daytime too and the Date (without time information) is stored in the variable. How can I ask only for a Date and store only a Date?
Another question: I'm using the jBPM-server-distribution 7.36.0.Final and Dates in the DatePicker-Control have the format mm/dd/YYYY. Would it be possible to show Dates with the format dd/mm/YYYY?
Thanks for your help!

How to save date into database with current time?

I have a table in database, one of the row adds add while something was done/acomplished. And it works fine. But.. it doesn't add current time. When I prints out date from db, it shows 2016-12-13 00:00. Instead of for example 2016-12-13 15:32. How do I add current time?
This is how my sql looks
[example_date] DATE NOT NULL,
The date data type does not have a time component. You want either datetime or datetime2 (or perhaps smalldatetime):
example_datetime DATETIME NOT NULL,
You can review the documentation for the various date/time data types here.

Handling Date Format - VB.Net/SQL Server Based WebApp

I have a Web App and trying to make date format configurable by users as for example people in London should be able to view and enter dates in dd/MM/yyyy format while people in the US MM/dd/yyyy.
Dates are being stored in the DB in smalldatetime. Displaying according to user preference is no issue as String.Format or toString(format) can be used according to user preference whenever a date is displayed. The issue is when a user enters the date. Suppose the server is in the US and uses US cultureinfo by default. So when a date in MM/dd/yyyy format is entered by the user on a page, the server works fine. But not able to figure out the best way to implement such that when user preference for date format is dd/MM/yyyy and when user inputs a date, the code first converts it in MM/dd/yyyy format through some centralized setting so that all lines where dates are handled are not required to be changed.

how to insert current time automatically in table in oracle forms?

I have a problem in oracle forms.
My database is consisting of a main table,table name is (buy_order_customer) which has (b_order_id,customer_id,b_date,b_time).
I'd like to insert the current time automatically in the b_time column, I'm able to insert the current date in the b_date column but I can't do the same with b_time.
Both b_date, and b_time is of type 'date'.
can any one help please?
thanks in advance.
In Oracle DB a DATE datatype always contain both date and time (even if you don't display them.
So, if you inserted the current date into b_date then you already have the current time as well.
Try this:
SELECT to_char(b_date, 'mm-dd-yyyy hh24:mi:ss')
FROM buy_order_customer
and see that you have the time as well
I think you mean the initialvalue to fill these fields in a form at runtime.
If I'm right then you need one of the following system variables:
$$DATE$$ retrieves the current operating system date (client-side).
$$DATETIME$$ retrieves the current operating system date and time.
$$DBDATE$$ retrieves the current database date.
$$DBDATETIME$$ retrieves the current date and time from the local database.
I don't know any system variable to retrieve only the time.
If it is for displaying purposes you need to use dateformat masks on your fields.