Is there any query to insert country name and its time zone in GMT, for a mysql database. I want to add all the country name and its time zone difference with GMT or UTC
try to google the list but you may have to actually write extraction code
On top of that, large countries like USA, Canada & Russia have multiple time zones
Its all up to you how you want to design the database and code according to that.
This is the list Fedora is using...
http://unicode.org/repos/cldr/trunk/common/supplemental/windowsZones.xml
start from here
Here is another list
http://www.timegenie.com/world.time
Related
I have a form that captures production data for a certain process. When a employee enters production numbers, currently I am not sure what the time frame for the production numbers are.
E.g. Employee A enters a production number of 50 on 2017/10/02. This 50 represents the production of 1 day (2017/10/01). Now, employee B enters 550 on 2017/10/03, but this represents production for the week of 2017/09/24 to 2017/10/01.
Now, we know that various employees will be providing data of different time frames, but I'm trying to figure out the best way to manage this. I capture data using a Excel sheet with VBA, and then transfer it to a SQL database. Currently, in the database we use GROUP BY to get all data related to a certain month. So if the timestamp of the data is in September, all September data will be summed and the total used as the September total to date. However, this does not answer two key points:
If data for September is entered in October.
If data is entered that duplicates a period for the employee that was entered earlier.
What is the best way of managing this? I can change my capturing form and the way we manage data in the database.
EDIT and more information:
The information I want to capture consists of production numbers from various production areas entered by an employee. So for example, site A will have 3 sub-sites. These sub-sites will each have a production achieved, target for the period and forecasted production number.
Timestamp: Site: Sub-site: Production: Target: Forecast:
2017/10/01 PlaceA Line1 200 250 230
I receive csv files at the end of each month from my customer for each of their KPI (for example csv's for resumes received, candidates joined, candidates resigned, sales, profits, loss , etc) for that specific month.
I want to be able to query this data inorder to generate reports for any month, day or year. This report will be generated dynamically i.e the admin would specify what rows he would like to have in a report (for eg a report with applications received, applications shortlisted, candidates shortlisted after the 1st interview for the period of jan to july.) for any period of time.
What would be the best way to store the data into my database in order to generate such reports? I am using Mysql as my database.
I am not sure if I would need to flush out the old data from my tables currently. So considering that I keep all the data persistent, what would be the best suited database design for this?
Currently what I do is I have a table for each of their KPI. This table has got a date field which I am using to generate the report. But I am looking for a more optimized way.
Thanks in advance.
It is better to store those values (month or year related values ) in a "Date" type fields which would not need any other manipulation while building reports. The conditions or logic for the specific period of time should be handled in your front end. In this case, the usage of Date field is the optimized way.
I am new to database development and am currently working in MySQL.
I have a column that contains all the time zones for USA. I want to be able to get the current time (only time, no date) as of right now for each time zone in each row.
The TimeZone data looks like: +05:00, -03:00 etc etc etc
This is how I have attempted it. I have 2 tables, one country, one city. TimeZone is found within "city" table. I have tried to use the function sys date() but it returns the complete date and the current time on my system, not based on the time zone. Can anyone help me out? Thanks a lot
select TimeZone, Country, sysdate() as "Current Time"
from city, country
where Country='USA' and city.CountryId= country.CountryId;
You should be able to use the convert_tz function:
SELECT CONVERT_TZ(NOW(),'-07:00', city.TimeZone) AS Time, city.Name
FROM city, country
WHERE country.Name='USA' and city.CountryId= country.CountryId;
Assuming your server is in -07:00 timezone.
user login from india at 9:00 am
other user from usa at other time.
how handle this if both the user having same server but login from different timezone
You haven't really told us what your problem is, but the best way to handle multiple timezones is to always store your timestamps in UTC, and convert from local to UTC on insert, and from UTC to local for display.
You could store timezone offset for each user (make the user select one timezone when he creates the account) and do the transformations based on that
I have unpredictable frequency of Incoming csv data file which I need to store into mysql database. I can get multiple csv file in a day or I can get one csv file in one week.
CSV files contains data that is valid for the day when it was received meaning it contains offers details which are valid for only the day file was send and so my question is that is it possible to store this data into mysql database according to dates of its arrival.
Meaning If I received csv file on 19th December, 2009 and than on 20th December, 2009 than in mysql database can I have some sort of way to partition such that I will have heading 19th December, 2009 and than under it would be all offer data relevant for that day and than will have 20th December, 2009 which will then have all offer details relevant to that day instead of having generic tables and entries as this is the explicitly mentioned in client's requirement that they do not want generic tables and entries.
you could set a column to equal the creation time of the file. (The closest thing on most unix fs would be the ctime. In php filectime()).
If you actually need to create new tables or columns named after the arrival times, your script would need to call create table, or alter table add column, etc with the formatted date string.
In your table, add a column of a DATE type, which you set to the current date when you process the CSV file. (Assuming you process it when it arrives).
If each entry has a timestamp, then why not just include that field as a datetime field in the MySQL database?