I feel like maybe the only way to do this is manually but I thought I'd ask here.
I work with a lot of schedules in media production and 100% percent of these come as PDF's in a similar format.
Episode #
SC Due
NC Due
Locked
Final
101
9/21
9/28
10/3
10/10
102
9/23
9/30
10/6
10/12
So forth and so on.
I can extract the info that I need from the PDF pretty easily by hand, but I can't figure out how to automate the import into a calendar. I just keep finding myself reformatting everything by hand and at that point. I might as well import the calendar by hand.
What should I be looking for to help.
Ideally, I'd have an event for each entry.
101 SC - 9/21 - ALL DAY
102 SC - 9/23 - ALL DAY
101 NC - 9/28 - ALL DAY
102 NC - 9/30 - ALL DAY
101 LOCKED - 10/3 - ALL DAY
102 LOCKED - 10/6 - ALL DAY
101 FINAL - 10/10 - ALL DAY
101 FINAL - 10/12 - ALL DAY
So forth and so on.
Thanks. Cheers.
Related
I'm trying to create a stop report for my plant while learning SQL.
The goal is to get a report containing the amount of minutes stopped planned and unplanned and the amount of stops planned and unplanned. All of this should be reported by day.
Currently I have these values:
Datum: Date
Unplanned: The amount of minutes our plant stopped that day when it was not planned
#unpplanned: the amount of stops we had that day that were unplanned
Daysunplanned: The amount of days the unplanned stop lasted
planned: The amount of minutes our plant stopped that day when it was planned
#planned: The amount of stops we had that day that were planned
dayspl: The amount of days the planned stop lasted
nextday: The amount of minutes that the stop took that should be counted to the next day. A stop can last from 20:00 7/02/2023 till 05:00 8/02/2023).
Can't embed yet :/
My issue is the following:
On 2023-02-06 the plant stopped 1130 minutes unplanned. The stop lasted till 07-02-2023. You can see this because dayunpla = 1.
So the results should be:
2023-02-07 1378
2023-02-06 1130
If dayunpla = 4 we should get:
2023-02-11 1378
2023-02-10 1440
2023-02-09 1440
2023-02-08 1440
2023-02-06 1130
1440 is 24 hours.
I can't think of a way to get from my current table to what I want.
I tried all google searches I could think of but did not find anything helpfull.
Is there a way to fix this using just SQL?
Thanks for your time!
Tried google and a lot of tinkering
Goal: highlight regular trading market hours in a plotly chart.
-Using a df with standard datetime and 1 minute intervals.
-Regular trading hours = 9:30am EST to 4pm EST
—-Incase interested:
——-pre market = 4am to 9:30am
——-post market = 4pm to 8pm
Stack overflow has great links for highlighting weekend data like this:
Nevermind that link was just removed by the author as I tried to post it, but it’s too difficult for me to translate that to specific times of day anyway.
This is relatively easy to do using fig.add_vrect()
I built a similar highlighting system for night and day:
time = df.index.get_level_values("time")
# Getting info for plotting the day/night indicator
# time[0].date() picks out 00:00 (midnight) and then we add 6 hours to get 6 am.
start_morning = pd.to_datetime(time[0].date()) + pd.Timedelta(
hours=6
)
end_morning = pd.to_datetime(time[-1].date()) + pd.Timedelta(
hours=30
)
num_mornings = (end_morning - start_morning).days
# Now we build up the morning times, every day at 6 am
mornings = [
start_morning + timedelta(days=x) for x in range(num_mornings)
]
for morning in mornings:
fig.add_vrect(
# Highlighted region starts at 6 am and ends at 6 pm, every day.
x0=morning,
x1=morning + timedelta(hours=12),
fillcolor="white",
opacity=0.1,
line_width=0,
)
For you, it would just be a simple matter of adjusting the times. So for instance, for 9:30 am you can use
morning = pd.to_datetime(time[0].date()) + pd.Timedelta(hours=9.5)
to get the first day of your data, at 9:30 am. Now in fig.add_vrect() use
x0= morning
x1= morning + timedelta(hours=6.5)
to highlight between 9:30 am and 4 pm.
I need some help converting military time separated by a pipe into standard time. In addition I would like to know if it's possible to decode the pipe into a day of the week.
When I query for a customers hours of operation I am presented with the following result:
|0900|1800|0900|1800|0900|1800|0900|1800|0900|1800|0900|1300||
The first pipe equals Monday Open, second pipe equals Monday Closed. The third pipe equals Tuesday Open, the fourth Tuesday Closed etc. etc.
What I would like to see is something like
Monday: 9:00am - 6:00pm,
Tuesday: 9:00am - 6:00pm,
Wednesday: 9:00am - 6:00pm,
Thursday: 9:00am - 6:00pm,
Friday: 9:00am - 6:00pm,
Saturday: 9:00am - 1:00pm,
Sunday: Closed.
Is this possible to convert in Oracle?
select hours_of_operation
from customer_listing
where listing_id = '255990748'
Here is a SQLFiddle to get you started. The first day would be:
select 'Monday: '||
to_char(to_date(substr(hours_of_operation,2,4),'HH24MI'),'HH12:MIAM')
||'-' ||
to_char(to_date(substr(hours_of_operation,7,4),'HH24MI'),'HH12:MIAM')
from test
Then just add on, and move the substring function indexes.
UPDATE: I just realized this will only work for fixed fields. If you are missing a day, it will fail. That really requires a function to be written to handle some of the parsing logic.
I am working on the crystal report Xi and my problem is in my report I have to show the count of the days patient spend on one place, they can get transfer any number of times or they don't get transfer even one time. So every time they transferred from their admission to discharge I want to count of days on that place the patient spend.
PatID Admission Discharge Place TransferPlace TransferDate
121 05\06\2013 06\01\2013 102 105 05\10\2013
121 105 101 05\20\2013
121 101 108 05\25\2013
Here I just created a data the patient first transfer on 05\10\2013 from 102 to 105 that means he was at 102 since he got admitted (4 days) and in 105 he was for 10 days.
I hope it should be clear.**
Try DATEDIFF() function it will return the date difference
To get the difference between dates you use the DateDiff function. In your case you want to get the amount of days between the dates, you would use:
DateDiff(day, {Admission.Date}, {Transfer.Date})
{Admission.Date} and {Transfer.Date} are the date fields you would be using in your report.
EDIT:
So I think you can make this work using the PREVIOUS function in Crystal. Try something like:
if isNull(previous({Transfer.Date}) then
DateDiff(day, {Admission.Date}, {Transfer.Date}) else
DateDiff(day, previous({Transfer.Date}), {Transfer.Date})
You could also go the other way by using the NEXT function.
Working from an oracle 10g environment.
Suppose you were given: *NOTE (Duration is in Weeks)
CLASSNAME INSTURCTOR DAYS STARTDATE *DURATION TIMESTART TIMEEND
------------------------- ----------------------- ------------- --------- -------- --------
Power Dance Robert Backman MWF 03-MAR-11 2 0930 1100
Power Dance Lynn Parker MWF 03-MAY-11 2 0930 1100
Power Dance Lynn Parker MTTh 18-MAY-11 2 1230 0100
Club Stretch Kevin Lopez MT 24-OCT-11 3 1930 2015
Club Stretch Kevin Lopez F 17-JUN-11 3 1130 1300
Hatha Yoga Susan Wanzer MW 25-MAY-11 3 1900 2000
A user wants to be able to query the Classname, Instructor, Timestart, and TimeEnd for a class given a specific date.
I understand how to find the EndDate using (Duration * 7) + StartDate. The trouble I am having is finding out which classes are running on a day of the week. As in say the user enters in 24-JUN-11, the only class that should show up should be Club Stretch.
It might be just a matter of rephrasing your question: you want to know which classes are starting at of before the specified date and are ending at or after this specified date.
You already have the starting date and you know how to calculate the ending date.
This will be your solution:
SELECT [columns]
FROM [table]
WHERE #specifiedDate BETWEEN [startDate] AND [calculatedEndDate]
AND [days] LIKE #specifiedWeekday
#specifiedWeekday should, when looking for a Monday, have a value like this (in MS SQL): '%M%'
NOTE: Just now read your working in Oracle. This is a SQL Server answer. I hope the idea behind it will help you along.
Looks to me that you need to first determine the day of the week store that as a variable that you would feed to the second to the second query. Query sample for first part below:
select to_char(to_date('31-May-2011','dd-Mon-yyyy'),'DAY') from dual
SQL> /
TO_CHAR(T
---------
TUESDAY
or
select to_char(to_date('31-May-2011','dd-Mon-yyyy'),'DY') from dual
TO_
---
TUE
then you could feed that into your other query with your now known day of the week. If you need to decode it to the formats you mention then the following code will convert the day of the week to the abbreviations you are showing:
select decode(to_char(to_date('26-May-2011','dd-Mon-yyyy'),'DY'), 'MON','M',
'TUE','T',
'WED','W',
'THU','Th',
'FRI','F',
'SAT','Sa','Su')
from dual
will return the Th you are using :)