Date conversion dot to dash (i.e. 2001.01 to 2001-01) - r

I am working with a data set where the Period is given as
2001.01,2001.02,2001.03......When I am trying to convert it using yearmon() it shows only Jan and Feb this two month.For
example for 2001.05 it shows Jan 2001. But it should be May 2001. I think I need to convert the Period in 2001-01 format
first before using yearmon(). Can anyone plz tell me how can I do it?

Related

How to generate matched-pairs based on dates?

I have a dataset that includes dates and count of reports. I am tasked with generating matched-pairs using these guidelines:
Reports will need to be matched to the week immediately prior to or following. (For example: Jan 23, 2000 will be matched with Jan 16, 2000 and Jan 30, 2000)
Holidays must not be included in the final matched-pairs generation.
I have been able to identify the holidays within the dataset but am still stuck on how to generate the matched pairs. Any advice would be much appreciated!
Example of the Data
I am making assumptions as I could not ask for clarifications.
Assumptions I made
a> You wanted to get a formula bash
b> You wanted the date closest matching the previous week to the specific date. for example a Monday event needed to match closer to an event on Monday the previous week. As the data set you gave showed multiple reports through the week. It was not clear what pattern of the previous week you wanted to match.
Solution based on Assumptions.
1> You can mathematically turn each date to a grouping of which week they were in for the year. Then match them to one another. For example 1/1/2003 would be 1.1. A date in 14/1/2003 would be 2.1.
You can then patten match on if 1.1 = 2.1 if that hits it's a match if not it would loop until it saw an entry in the range of 2.[0-9]. You can place an if statment to check if there is a holiday on the match, if there is one it will continue the loop.

DateTime in Unity as a very large number

I'm trying to understand a saved game file format.
The game is written with Unity.(not sure that it's related)
The file is a JSON file and the timestamp is:
"Timestamp": 637015624965194930,
This translates to Aug 16th 2019 at 14:28
another example is:
"Timestamp": 637014628610503310,
This translates to Aug 15th 2019 at 10:47
I figured that subtracting the 2 numbers will give me the difference and it kind of works.
It seems that the time is measured in 1/10000000 of a second.
Can anyone figure out how to convert this to EPOCH time?
This time is 1/10000000 of a second since Jan 1st 0001
It is the standard time format used by .NET
so you can subtract 621355968000000000 (Jan 1st 1970) and divide by 10000000 to get seconds since EPOCH.

Converting dates in SPSS

I have data from Survey Monkey and the dates that the responses were provided are transferring over in a strange format. They look like:
"1036914:34:45.00"
I have altered the variable type to every available option that SPSS provides and none of them are giving me the right data.
The number that I pasted above should be a date/time between the end of March and the beginning of April of 2018.
Any thoughts?
This should be the number of
"hours:minutes:seconds.centiseconds"
that have passed since 01/01/1900. I looked it up and your example would be
Monday 16 April 2018 at 18:34:45
This is probably an MS Excel format?

Extraction Date in business objects

I am using Business Objects Edge and on a report I want to create has a front cover and I was hoping to add the month and year of the previous month in the following format:
September 2015
Any help would be appreciated.
Thanks
B
I dont have access to BO Edge, I mocked up the following in BOE WebI XI3.1:
=FormatDate(RelativeDate(CurrentDate();(DaysBetween(CurrentDate(); ToDate("01/" + FormatDate(CurrentDate();"MM/yyyy"); "dd/MM/yyyy"))-1)); "Mmmm yyyy")
This gives you the days between now and the start of the month, which today will give you -26 and because we want last month then you would minus another day. Then using I formatted the date so that it appears as the Month Year.

PL/SQL group by week

In MySQL I am using
week(date,3)
to get correct values of week grouping.
How to translate this to PL/SQL? I'v tried the following but what about this 3 from week function in mysql?
TRUNC (created_dt, 'IW')
Oracle is using the NLS setting of the database to determinate how the week number should be calculated and therefor there is no need (according to Oracle) for the '3' part pf the MySQL function. I can image that there still should be useful to have this option but this is once again a sign of the fact that Oracle does not fully understand the needs of working outside USA.
Based on your MYSQL statment above, it returns the week of the specified date e.g. 2012-12-07, 3 as the second argument defines that the third day of the week is assumed as Monday...
If you look at this article it says there are 8 ways MYSQL WEEK() function can behave. So you gotta let us know what results you are trying to achieve by looking for MYSQL Week equivalent function in PL/SQL.
In most staright forward manner, MYSQL WEEK(date[mode]) returns the week number for a given date.
From re-reading your question, the only thing I grabbed that you want to achieve the first feature within PL/SQL and so you are looking for an equivalent function.
And with Oracle it gets slightly RAMEN...
W Week of month (1-5) where week 1 starts on the first day of the month and ends on the seventh. It goes on with how the year starts. E.g. 2012 started on a Sunday, ORACLE THINKS.............. that weeks are Sundays to Saturday.
iw Week of year (1-52, 1-53) based on the ISO standard. Hence the weeks do not necessarily start on Sunday.
WW Week of the year (1-53) where week 1 starts on the first day of the year and continues to the seventh day of the year.
By default Oracle NLS settings are set to following:
NLS_CALENDAR : Gregorian
NLS_DATE_LANGUAGE: AMERICAN
NLS_TERRITORY: AMERICA
So you can suggest Oracle to follow the calendar by manipulating your query level....
You could something like this:
select trunc('2012-12-07','YY') AS week_number,
to_number(to_char(trunc('2012-12-07','YY')+rownum-1,'D')) AS dayNumber_in_week
from dual connect by level <= 365
where to_char('2012-12-07','IW') = 3
and to_char('2012-12-07','DY') = 'MON';

Resources