How to Get time from CSV data? - database

i have downloaded a csv file from my database.
in date field i found
1416551169
1417798664
1415727808
etc as times
please can anyone please tell how to extract time and date from it like 01:04:2014 10:30 PM
Thank you

That is a Unix timestamp. You can convert from the Unix time stamp to Excel with the following Excel formula (assuming Unix Time Stamp is in A1)
=A1/(60*60*24)+"1/1/1970"

The numbers you downloaded like like timestamps, probably representing the number of seconds after a particular point in time. Depending on what programming resources you have available, you should have a function to convert the raw timestamp into a person-readable date.

Related

Sort by date in Looker Studio (DataStudio)

so I am facing this issue with sorting the data, in the table, by the date. The thing is that I had to change format so that I can see the all together Day of Week, Date, Hour, Minute.
FORMAT_DATETIME("%a %d.%m.%y. %H:%M",MY DATE)
which caused that the sorting is now done alphabetically and the variable is treated as a text and not a date anymore.
enter image description here
Is there any way to include all information and be able to sort by date?
In the Looker Studio documentation (https://support.google.com/looker-studio/answer/9730334?hl=en) we find that FORMAT_DATETIME converts a date to formatted text.
Try to use PARSE_DATETIME (converts text to a date with time)
If you don't have the seconds part simulate them PARSE_DATETIME('%Y-%m-%d %H:%M:%S', CONCAT(DT_ATTRIBUTE, ':00'))

Converting string date from one timezone to UTC in Datastage

I would like to convert dates I receive from timezone 'Europe/Warsaw' to UTC. I have tried to find suitable libraries in C to create a Datastage routine. I did not find anything that would allow to flexibly change the source timezone keeping in mind the change from summer to winter time (daylight). Another way is to use a database function, e.g. in DB2, but currently I am trying to solve the problem without creating stored procedures. Anyone solved a similar problem?
I get the input date in the format 'YYYY-MM-DD HH:MI:SS',
Input Timezone = 'Europe/Warsaw',
Output Timezone = 'UTC'.
I would like to create a solution that would allow me to swap e.g. Input Zone, something passed by parameter e.g. 'Europe/London'. I cannot rely on the system time unfortunately.

Converting UNIX time to Date in Google Data Studio

As title, is it possible in Google Data Studio to Convert Unix Timestamp to a human-readable date?
For example, to convert '1618087345 to a date format consisting of year month day.
Actually, to treat a field with an Unix timestamp as a date, you don't need to do anything. Just mark the field as "Date & Time" type and you're done.
Check this Data Source and Dashboard as an example:
Data Source
Dashboard
If you really need to convert manually for whataver reason, you may want to have a look into DATE_FROM_UNIX_DATE function.

Realstudio (2011 4.2) Date in Milliseconds

In my project I communicate with a Microsoft SQL-Database where I have a column with DATETIMEs. The date-information in the database is with Milliseconds, that's very important, like 2012-03-03 12:00:00.364
In Java, for example, it's no problem to read the Date value from the RecordSet with Milliseconds.
In Realbasic when I do something like that time = rs.IdxField(i).DateValue the milliseconds are lost, because the Date-Object has a maximum resolution of seconds.
How can I read the SQL-Datetime with milliseconds? What can be an easy way to read it as String and then parse it or something like that?
If you already have the information in a database and are just reading from your SQL database, I'd recommend subclassing Date, adding a variable for Milliseconds, and then just manually parsing out from the period/etc to get the milliseconds value.
dim d as new DateWithMilliseconds
d=rs.IdxField(i).DateValue
////and then however you'd parse out the milliseconds based on the string format
d.milliseconds=NthField(rs.idxField(i).stringvalue,".",2)
You could then add other functions for comparing the date subclass to include the milliseconds variable.
Use Convert Statement
Syntax:
select CONVERT(nvarchar(30), GETDATE(), 126)
try it.
Tiz

What date format is this?

I am trying to query some data out of Home Bank using the data file it produces.
This is a transaction that appears in the file:
<ope date="734309" amount="-14.24" account="4" dst_account="0" paymode="0" flags="1" payee="239" category="2" wording="" info="" tags="" kxfer="0" />
I am interested in the date="734309". I've not seen this format before so don't know how to parse it.
The application is written in C if that is any help.
734309 / 365 = 2011.80548
So I guess it's something like "days since 1 January in the year 1". If you know the actual date that that number should represent, you can reconstruct the precise offset from there.
It's probably the result of the SQL TO_DAYS() function, which represents the number of days since the first day of 1 A.D. (I don't know whether TO_DAYS() is specific to MySQL or if it's a standard SQL function.)

Resources