Having an issue with ascertaining the format of a date - date

I've been tasked with getting data from an existing database table and transferring it into another. Everything is fine except the date in the original table is in a format that I don't recognise. It looks suspiciously like a unix timestamp but when converting it it seems to be coming out as the year 2727 or something.
Here is an example of what's in the existing table: 1424786878240
The matching date for this on the front end of the site is 24th February 2015. I cannot seem to find any correlation between this and the number in the database - and since I have no access to the original site code I am unable to determine how it's being converted.
If anyone recognises this date format / structure I would appreciate some help.

Related

Powerapps Filter Collection By Today's Date

Good day all,
I am trying to filter todays result in SQL table to a collection in powerapps. The column "dt" represents the column in sql of datetime type.
This is my powerapps filter:
ClearCollect(myCollectionName, Filter(myDatasource, Text(dt,"dd/mm/yyyy") = Text(Now(),"dd/mm/yyyy" )));
Seems like the collection is still empty even there is data for today in sql. May I know if my approach is the correct way in filtering?
Short answer: the data is likely being changed based on the client time zone. To fix it, you can update it by applying the time zone offset to the data from the SQL table, something along the lines of:
ClearCollect(
myCollectionName,
Filter(
myDatasource,
Text(DateAdd(dt, TimeZoneOffset(dt), Minutes), "dd/mm/yyyy") =
Text(Now(), "dd/mm/yyyy")))
Long(er) answer: the datetime type in SQL Server represents an absolute value of date and time. For example, the value '2021-12-23 09:30:00' represents 9:30 in the morning of the 23rd day of December, 2021 - at any part of the world. The date/time type in Power Apps, however, represents a point in time, typically referring to the local time where the app is being executed (or created). For example, if I selected that value and I'm in the US Pacific Time Zone (UTC-08:00), that would represent the same value as if someone in London (UTC+00:00) selected 2021-12-23 17:30:00. Since the two types represent different concepts, we may have mismatches like you are facing. To fix this, we can either use a type in SQL Server that has the same semantics as Power Apps (for example, 'datetimeoffset'), or adjust the time when it is being transferred between SQL and Power Apps.
The blog post at https://powerapps.microsoft.com/en-us/blog/working-with-datetime-values-in-sql explains in more details how to work with date/time values in SQL and Power Apps.

Qlik Sense: Change date field format from Google Analytics API

I've pulled in data in Qlik Sense (cloud) from the Google Analytics connector. I'm trying to convert the standard date [ga_dateHourMinute] field to a more eligible date format.
The current format is YearMonthDayhHourMinute, for instance: 201810250004, I would like to convert this to the standard date format 2018-10-25 00:04:00. How do I do this? Answers concerning methods in the data load script or master formula's or variables are all welcome.
Click to see screenshot: left = current date format and right = desired date format
This is one approach:
DateAlter:
LOAD * INLINE [
Date
201810250004
];
DateAlter2:
LOAD
Date(Date#([Date], 'YYYYMMDDhhmm') ,'YYYY-MM-DD hh:mm') AS [MyDateField]
Resident
DateAlter;
If you haven't played around with the data manager, it will allow you to edit fields and handle dates in a fairly easy manner:
Qlik Sense Data Manager
I ended up creating a text fields that combined the different digits from the one field into a new order, then pushed the data format into a date/time. Quite a bit of work, but fairly solid.

Why am I getting iso 8601 dates from my Postgres database?

I'm using Seekwell to connect my AWS postgres database to Sheets.
I think I'm converting my dates to standard 'date' (YYYY-MM-DD) format in the code, eg.
date(date_trunc('day', u.created_at::date)) Date_Created
However, when the query is run, my dates are iso 8601, eg.
2018-05-16T00:00:00.000Z
Of course, given that my results are going into Google Sheets, I can always convert those dates there in sheets, but that adds a layer of complexity that is hard to manage.
How can I make sure the dates are formatted correctly before the results land in sheets?
Michael from Seekwell tells me this is:
a bit of bug with how JDBC handles dates in the background. You're on Postgres, right? This should work from within the add-on:
to_char(your_date_column, 'YYYY-MM-DD')
Sheets will recognize that result as a date.
This worked.

Date Format in Power BI Hierarchical Slicer

I have a Power BI file that connects to a data model via SSAS. The data model origin is a SQL Server view with some computed columns added in via SSAS.
One of the visualisations is a Hierarchical Slicer that shows dates. The field is not one of the computed SSAS columns. It displays in DD/MM/YYYY format but when I place the file on a Power BI Report Server the format is Americanised to MM/DD/YYYY. I want it to be DD/MM/YYYY.
The same field is used to populate a table visualisation but in there it remains DD/MM/YYYY. Just the slicer is affected.
This blog https://community.powerbi.com/t5/Desktop/date-format-in-slicer/td-p/215627 seemed to have the answer I needed but these settings were already applied and still the slicer shows MM/DD/YYYY.
Its not a problem when I open the pbix file locally; there, the slicer shows the dates as DD/MM/YYYY, its just when its on the server. The same problem persists in Test and Production and I have checked those settings and they are as the blog indicates. Other blogs identify this with the slicers but do not present a real solution as its not seen as a problem in those topics.
I've only spent a month working with Power BI so have no real experience to draw upon. I know that SQL Server defaults to American English when connecting to a database and I have changed that to British English but still the same problem. How do I get the slicer showing as DD/MM/YYYY as in my local copy?
Select the Date column and then go to the Modeling tab and change Format to whatever Date format you want.
OR
You can create a calculated column using the FORMAT method in DAX to convert date format as you want.
See reference here: https://msdn.microsoft.com/en-us/library/ee634398.aspx
Power BI is missing the formatting in their recent releases. However, the below solution works for me:
Create a Calculated Column ref. the original Date column and apply "Short Date" format for Date, example:
Transaction Date =
FORMAT(DATE(
YEAR([Transaction_Date]),
MONTH([Transaction_Date]),
DAY([Transaction_Date])
), "Short Date")

Btrieve Date Integer

this is my question:
I'm migrating data from a Btrieve file (.dat) through Pervasive Control Center and there is field type which is defined as integer but is a date and for example the date '31/12/2009' (seen in the legacy system) is view it as the number 733772 when I export it.
The legacy system shows the date correctly but I can't export it in the same format or at least I can't convert it. Does anybody know how to convert this number through Excel or something?
When I divided 733772 by 365.2425 (Number of days in year considering Leap year and 29 days of Feb - http://www.timeanddate.com/date/leapyear.html), it gave back 2009.
Go to format cells and changing category to date.