Calculating time until a next monday
Hi,
I am trying to get a good calculation to set the initial delay of a timer. I am implementing a scheduler which will fire every monday at 16:00. If my applications starts I need to calculate how many milliseconds are left from now until the next monday 16:00 for the first trigger.
I tried several simple calculations but i can't get it right.
Does anyone know a simple trick or method which does this for me?
Hi,
you can try it with:
//define a start day
java.util.Date today = new java.util.Date();
Calendar cal = Calendar.getInstance();
//set next monday
cal.setTime(today);
cal.add(Calendar.WEEK_OF_MONTH, 1);
cal.set(Calendar.DAY_OF_WEEK, 1);
cal.set(Calendar.HOUR, 16);
cal.set(Calendar.MINUTE, 0);
cal.set(Calendar.MILLISECOND, 0);
//calculate miliseconds from start date
long milisecLeft = cal.getTime().getTime()-today.getTime();Hope it helps
regards
Similar Messages
-
When i plug in my iPad2, iPhoto comes on not iTunes. I see iPad in system profiler under USB. I have reset, removed and re-downloaded iTunes. When I download iTunes it works until the next time i plug in the iPad2 and then the same thing all over.
Go through this support doc:
OS: Device not recognised in iTunes
Windows: http://support.apple.com/kb/TS1538 -
I have been using time machine to back up my Mac Book Pro 3.1 to my Time Capsule. Now the Time machine hangs up on "calculating time remaining".
Mac Book Pro - 3.1-15-inch 2.4/2.2GHz), Processor 2.2 GHz Intel Core 2 Duo
Operating system : OS X 10.10.1
Time Machine Version 1.3, Copyright 2007-2014 Apple Inc., Modified Tuesday, September 9, 2014 at 6:03 PM
Time Capsule: 500 GB C 2007
This Time Machine software worked satisfactory until Monday Nov, 10 2014 and I have backups until that time. For several years, the software deleted the oldest back up to save the latest one. This is acceptable to me as I have off site storage that is updated every 3 months. How do I get Time machine working again?I have spent a couple of days trying to respond to Linc Davis. Finally I figured it out . The following is a copy of data from my console from the initiation of a time machine backup until it gets stuck trying to calculate the time remaining. There is no indication that anything starts saving. I copied about 3 minutes of data. This is probably way too much data, but I do not know what is relevant.
Thanks for the help,
calcool
12/22/14 3:16:54.655 PM com.apple.backupd[551]: Starting manual backup
12/22/14 3:16:55.057 PM com.apple.backupd[551]: Attempting to mount network destination URL: afp://”name”%20”lastname”@Home%20Network%20Time%20Capsule._afpovertcp._tcp.loca l./Time%20Capsule
12/22/14 3:16:57.262 PM mds[33]: (Volume.Normal:2464) volume:0x7fed5ab54000 ********** Bootstrapped Creating a default store:0 SpotLoc:(null) SpotVerLoc:(null) occlude:0 /Volumes/Time Capsule
12/22/14 3:16:57.565 PM com.apple.backupd[551]: Mounted network destination at mount point: /Volumes/Time Capsule using URL: afp://”name”%20”lastname”@Home%20Network%20Time%20Capsule._afpovertcp._tcp.loca l./Time%20Capsule
12/22/14 3:17:08.000 PM kernel[0]: hfs: mounted Backup of “name” “lastname”’s MacBook Pro on device disk3s2
12/22/14 3:17:09.625 PM com.apple.backupd[551]: Disk image /Volumes/Time Capsule/”name” “lastname”’s MacBook Pro (2).sparsebundle mounted at: /Volumes/Backup of “name” “lastname”’s MacBook Pro
12/22/14 3:17:11.112 PM com.apple.backupd[551]: Backing up to /dev/disk3s2: /Volumes/Backup of “name” “lastname”’s MacBook Pro/Backups.backupdb
12/22/14 3:17:24.931 PM “name”[593]: audit warning: soft /var/audit
12/22/14 3:17:24.944 PM “name”[594]: audit warning: allsoft
12/22/14 3:17:24.958 PM “name”[596]: audit warning: closefile /var/audit/20141222201654.20141222201724
12/22/14 3:17:26.544 PM com.apple.backupd[551]: Event store UUIDs don't match for volume: Macintosh HD
12/22/14 3:17:34.767 PM com.apple.backupd[551]: Deep event scan at path:/ reason:must scan subdirs|new event db|
12/22/14 3:17:34.768 PM com.apple.backupd[551]: Reading cached event database from: /Volumes/Backup of “name” “lastname”’s MacBook Pro/Backups.backupdb/”name” “lastname”’s MacBook Pro (2)/2014-12-22-151726.inProgress/F85FEA51-E137-471A-84DA-A2C00E4ECB42/.1BEF88C6 -20C3-3DDC-AE30-05EAB2AFCC15.eventdb
12/22/14 3:17:38.115 PM com.apple.backupd[551]: Using cached disk scan
12/22/14 3:17:39.114 PM com.apple.backupd[551]: Saved event cache at /Volumes/Backup of “name” “lastname”’s MacBook Pro/Backups.backupdb/”name” “lastname”’s MacBook Pro (2)/2014-12-22-151726.inProgress/5BC46A53-25E8-4C4A-8947-AFB221D1FA0C/.1BEF88C6 -20C3-3DDC-AE30-05EAB2AFCC15.eventdb
12/22/14 3:17:39.355 PM com.apple.backupd[551]: Not using file event preflight for Macintosh HD
12/22/14 3:19:14.782 PM CoreServicesUIAgent[294]: unexpected message <OS_xpc_error: <error: 0x7fff77befc60> { count = 1, contents =
"XPCErrorDescription" => <string: 0x7fff77beff70> { length = 18, contents = "Connection invalid" }
}>
12/22/14 3:20:15.207 PM locationd[182]: Location icon should now be in state 'Active'
12/22/14 3:20:17.267 PM locationd[182]: Location icon should now be in state 'Inactive'
12/22/14 3:20:17.884 PM locationd[182]: Location icon should now be in state 'Active'
12/22/14 3:20:18.483 PM sandboxd[296]: ([310]) com.apple.metada(310) deny mach-lookup com.apple.cfnetwork.cfnetworkagent
12/22/14 3:20:21.646 PM com.apple.metadata.SpotlightNetHelper[310]: [SLSUGGESTIONS] Location managed failed with error Error Domain=kCLErrorDomain Code=0 "The operation couldn’t be completed. (kCLErrorDomain error 0.)"
12/22/14 3:20:23.892 PM WindowServer[143]: disable_update_timeout: UI updates were forcibly disabled by application "Spotlight" for over 1.00 seconds. Server has re-enabled them.
12/22/14 3:20:26.526 PM WindowServer[143]: common_reenable_update: UI updates were finally reenabled by application "Spotlight" after 3.63 seconds (server forcibly re-enabled them after 1.00 seconds)
12/22/14 3:20:28.298 PM sandboxd[296]: ([310]) com.apple.metada(310) deny mach-lookup com.apple.cfnetwork.cfnetworkagent
12/22/14 3:20:29.094 PM com.apple.xpc.launchd[1]: (com.apple.quicklook[599]) Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.quicklook
12/22/14 3:20:30.670 PM bird[263]: Assertion failed: ![_xpcClients containsObject:client]
12/22/14 3:20:30.670 PM bird[263]: Assertion failed: ![_xpcClients containsObject:client]
12/22/14 3:20:32.294 PM com.apple.InputMethodKit.UserDictionary[600]: -[PFUbiquitySwitchboardEntryMetadata setUseLocalStorage:](808): CoreData: Ubiquity: “name”~00000000-0000-1000-8000-001B63947FCF:UserDictionary
Using local storage: 1
12/22/14 3:20:32.317 PM bird[263]: Assertion failed: ![_xpcClients containsObject:client]
12/22/14 3:20:32.769 PM locationd[182]: Location icon should now be in state 'Inactive'
12/22/14 3:20:34.580 PM Console[601]: Failed to connect (_consoleX) outlet from (NSApplication) to (ConsoleX): missing setter or instance variable
12/22/14 3:20:35.540 PM com.apple.xpc.launchd[1]: (com.apple.imfoundation.IMRemoteURLConnectionAgent) The _DirtyJetsamMemoryLimit key is not available on this platform.
12/22/14 3:20:36.388 PM com.apple.xpc.launchd[1]: (com.apple.auditd[604]) Endpoint has been activated through legacy launch(3) APIs. Please switch to XPC or bootstrap_check_in(): com.apple.auditd
12/22/14 3:20:36.693 PM “name”[608]: audit warning: soft /var/audit
12/22/14 3:20:36.718 PM “name”[607]: audit warning: allsoft
12/22/14 3:20:37.045 PM “name”[610]: audit warning: closefile /var/audit/20141222201724.20141222202036
12/22/14 3:20:37.438 PM bird[263]: Assertion failed: ![_xpcClients containsObject:client]
12/22/14 3:20:42.437 PM QuickLookSatellite[611]: CGSConnectionByID: 0 is not a valid connection ID.
12/22/14 3:20:42.437 PM QuickLookSatellite[611]: Invalid Connection ID 0
12/22/14 3:20:42.477 PM QuickLookSatellite[611]: CGSConnectionByID: 0 is not a valid connection ID.
12/22/14 3:20:42.477 PM QuickLookSatellite[611]: CGSConnectionByID: 0 is not a valid connection ID.
12/22/14 3:20:42.612 PM QuickLookSatellite[611]: [QL] No sandbox token for request <QLThumbnailRequest stackshot.log>, it will probably fail
12/22/14 3:20:42.613 PM QuickLookSatellite[611]: [QL] No sandbox token for thumbnail request file:///Library/Logs/stackshot.log, it will probably fail
12/22/14 3:20:42.615 PM QuickLookSatellite[611]: [QL] No sandbox token for request <QLThumbnailRequest stackshot-syms.log>, it will probably fail
12/22/14 3:20:42.615 PM QuickLookSatellite[611]: [QL] No sandbox token for thumbnail request file:///Library/Logs/stackshot-syms.log, it will probably fail -
I'm trying to calculate the number of days until your next birthday. Only using current month, day and birth month and day. I can get close but i'm way off. When i enter in the next day, the amount of days is supposed to be 364. This is where I am having problems. I know my code is way off. I just need some guidance please!
Attachments:
D5.7_1.vi 8 KBI just had a little fun with the Time Record...
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
Attachments:
D5.7_1_BD.png 19 KB -
How can I get the date of the next monday from the currentday?
How can I get the date of the next monday from current day? Please advice.
mayooran99Hi mayooran,
Please try the following code
DateTime nextMonday = DateTime.Today.AddDays(((int)DateTime.Today.DayOfWeek - (int)DayOfWeek.Monday) + 7);
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Hi all
I have read next monday solaris 10 6/06 will be launched worldwide, including new and waited zfs v. 1.0.
I have been using my solaris 10_x86 1/06 for some time ago... and I was wondering if it would be possible to upgrade my system (not re-installing it from zero) or even, install ZFS as install-alone packages??
Someone knows if it will be possible?The Solaris install program have an upgrade option, which you can use to upgrade from 1/06 to 6/06...
7/M. -
Hi,
We have a Planning 11.1.1.3 database with a nightly calculation. This calculation has been fairly stable, in terms of time, since early December, at 2 1/2 hours. Since 1/8, we have been experiencing increasing calculation times. On 1/8 and 1/9, it increased by about 15 minutes - not a huge jump, but then on 1/10, it went to 3 1/2 hours. I defragmented the database, which brought it back down to 2 1/2 hours for the next two days. Then on 1/12, it jumped to 3 3/4 hours. It seemed too soon to be fragmented, but I defragmented it anyway, but it only went back down to 3 1/2 hours. It's been hovering around 3 1/2 to 3 3/4 hours up to 1/19, when it went to 4 hours. Then last night, 1/20, it jumped to 5 hours. We did defrag again on 1/17, but that didn't touch the calculation time. On 1/12, we did change two previously dynamically calculated accounts to stored, and then calculated them. This calculation did not increase the blocks, though, just put a number into each block that had data that wasn't there previously. I did add these two accounts to the nightly calculation, but in looking at the log, the bulk of the increase is in a section of the calc that has nothing to do with those two accounts - nothing has been changed in that section of the calc at all. I can't think of anything else that could possibly account for these increasing times, and that doesn't seem like it could be the answer either. Any advice would be greatly appreciated.
Thanks,
SabrinaThere could be a few things happening here...
1) A nightly process could be running concurrently with the calc - eating up resources, making it take longer.
2) The application may not be using actual RAM, it could be using virtual RAM. Take a look using microsoft's process explorer found here. If the ESSSVR process resides in virtual memory is will take longer. Stop and restart all of the app/dbs, and then make sure the most important/resource consuming app is started first.
3) is everything else running slower? its possible that the server needs to be rebooted. When was the last time the server was rebooted? To determine this go to a command prompt and type systeminfo.
Also, go back in the logs, and see how many blocks the calc is touching (reading/writing, etc). Compare what you have now (3.5 hour runs) to back in Dec or Very early Jan. If it is not any of the above, the answers are probably in the log. Is it running serially now as opposed to parallel before? executing in cell mode? etc...
Good Luck.
-Matt -
Keep last frame of a clip until the next clip in the timeline?
Is there an easy method to keep displaying the last frame of a clip until the next clip shows up in the timeline. I do not want black video in between.
Video demo:
http://www.bartelsmedia.com/vid/tmp_premiere_question2.swf
I know that one can mess around with the playback speed of a clip but this makes it hard to exactly hit the beginning of the next clip.
Any ideas?
Ciao, GunnarYeah, Hunt. Frame hold certainly has room for improvement. It also suffers from the auto-deinterlacing bug wherein the held frame is (often?) deinterlaced whether you've ticked "deinterlace" or not, so it is totally unusable for me.
The workaround of exporting .BMPs is wretched also, as this forces a YUV->RGB conversion (for DV, HDV, etc.) that clamps the color range.
I don't like the rate changing method either, as there is a risk of inaccuracy -- especially if you need to tweak the ins/outs afterwards.
When I know I need to do lots of frame holds (such as with instructional animation, screen captures, etc.) I make sure I build in at least an extra second of no-mo where I plan to hold the frame. Then I copy/paste 1 second clips to fill the time. This sucks also, but it is the only way I have found around the other methods' limitations.
My PPro "frame hold fantasy vision" (based on my hazy recollection of my old NLE ca. 1993) is something like: Right-click, choose "Frame Hold at CTI" -- which would automatically set Marker 0 at the CTI, frame hold at Marker 0, and then allow you to infinitely pull the ends of the clip. The overextended regions should be indicated with grey diagonals on the clip in the timeline, just like when transitions run out of frames or nested sequences get shortened, etc. -
Problem at calculation time, when using Dynamic Calc measures
Hello,<BR><BR>We are using Essabse v6.5 and we want to upgrade to v7.1.<BR>we are performing some tests, in order to check that the Cubes we have created in 6.5 are working properly in v7.1.<BR><BR>the problem that we are experiencing is that the calculation time for the cubes that have dynamic calc members has exploaded to 10 times more, compared to what it took at version 6.5.<BR><BR>Do you have any idea why this happens. (also we are still using the old client "Application Manager")<BR><BR>Furhermore, I have set up 2 cubes that are the same, except the 1st has dynamic calc memebers, whereas the 2ns has not.<BR>I perform calcualtions with the SET MSG DETAIL; and receive the following:<BR>CUBE (A) with Dynamic Calc<BR>Total Block Created: [4.3720e+03] Blocks <BR>Sparse Calculations: [8.0620e+03] Writes and [2.5338e+05] Reads <BR>Dense Calculations: [2.8000e+01] Writes and [2.8000e+01] Reads <BR>Sparse Calculations: [6.0202e+06] Cells <BR>Dense Calculations: [1.1476e+06] Cells <BR><BR>CUBE (B) withOUT Dynamic Calc<BR>Total Block Created: [4.3720e+03] Blocks <BR>Sparse Calculations: [4.3720e+03] Writes and [3.5887e+04] Reads <BR>Dense Calculations: [2.8000e+01] Writes and [2.8000e+01] Reads <BR>Sparse Calculations: [6.0202e+06] Cells <BR>Dense Calculations: [1.1476e+06] Cells <BR><BR>Question: Why does Cube (A) has more Sparse Calculations than Cube(B) ????<BR><BR><BR>thanx
Yes, all the settings were exactly the same. See following:<BR>- Data Cache (note: we are NOT using the Data File Cache) <BR>- Index Cache<BR>- Index Page<BR>- Commit Block Interval<BR>- Cache memory Locking<BR>- Access Mode = buffered IO<BR>- Data Compression = Bit-Map encoding<BR>- Two Pass Calculatino = ON<BR>- Aggregate Missing Values = ON<BR>- CFG file<BR><BR><BR>Is there any new settings in 7.1 that I must configure?<BR>Is there any settings that I cannot see through the old client Application Manager, which is important? Must I install the new client in order to be able to configure correctly the Outline/Cube?<BR><BR>Thnkx<BR><BR>
-
I have been trying to update via App Store and every time only with apple software it starts to download and it will says it's calculating time remaining then an error message pops up saying " An error has occurred the request timed out. (102)" I have tried everything , I've been told its my ISP but I have tried using differenet internet to attempt the updates. Like I said all other software updates fine its just apple software
http://www.apple.com/support/mac/app-store/contact.html?form=account
-
I downloaded music to my iphone and when I went to go sync it up to itunes, I lost all of the songs purchased from that time until the previous time I backed it up. How do I recover these purchased songs that have been lost?
All of your music should be in itunes on your computer.
Select it to sync and sync. -
I'm running Windows 7 and iTunes (and the other Apple programs) wouldn't automatically update. Went through all the options and finally had to delete all Apple files and re-download iTunes. Worked fine, until the next update. Is there a glitch in the system? Does someone know of some proprietory block (I think it is related to Quicktime)? Also, once I re-downloaded everything, cleaned everything up, and deleted duplicate files, I closed down my computer. When I re-started it, iTunes was "brand new" -- all of my music, organization, tagging, etc. was gone and had to start over. Idea?
Ok, so after like 4 days of going through all these different issues, I figured out that several programs weren't downloading, and it was an issue with my wireless connectivity messing up the digital signatures, so if you plug in your comp to the modem and delete your temp files, it should start to work!
-
Time until full keeps increasing on charge.
I've just replaced my dying Macbook battery with a 3rd party Anker battery. It came half charged and seems to work fine but when I started charging it, the charge% goes up slowly but the Time until Full increases as well. So before it was at 50-something% and "1:30 until full". Now it's at 86% and "2:01" until full.
Do I need to worry? Calibrate? Is the battery a dud?
Thanks!Try D4 in the 1st linked article
Time Machine Troubleshooting
Time Machine Troubleshooting Problems -
File per cloud capacity that can be uploaded at a time, until a few gigabyte?
100G (CCT) I am currently in use.
File per cloud capacity that can be uploaded at a time, until a few gigabyte?The FAQ is at http://helpx.adobe.com/creative-cloud/kb/creative-cloud-connection-faq.html#id_74925
Is there a file size limit?
With Creative Cloud Connection preview, you can upload files up to 5 GB. If you attempt to upload anything larger, you can see some unexpected errors.
With the Creative Cloud website, you can upload files up to 1 GB. If you attempt to upload anything larger, you can see some unexpected upload failures. -
my kids enter wronge passwords several times until the ipad says"connect to iTune" but the ipad does not appear on the iTune.I know the correct password.
You've connected the iPad via cable to your computer, and your computer's iTunes is up-to-date ? If it's icon isn't showing then try one of these troubleshooting pages :
PC : iPhone, iPad, or iPod not recognized in iTunes for Windows - Apple Support
Mac : If you don't see your connected device in iTunes for Mac - Apple Support
If the iPad is disabled then you'll need to reset the iPad back to factory defaults, after which you can restore to your backup
Maybe you are looking for
-
Hi everyone, ATP is being a real struggle for us and we are for a required balance of not missing out on deadlines and improving the service levels if possible within the constraints. For a product not in stock it or available at a later date, the M
-
Biller Direct configuration for AR and AP
Hello, I have Biller Direct 6.0 installed and already configured XCM, but I would like to know if its possible to configure the application with Accounts Receivable and Accounts Payable at the same time to show bills from both? Thanks.
-
How to know currently running ddl by dba_views in oracle 9i
sql_hash_value in v$session is showing 0 .presently create table is running which is done by copying from another table. Edited by: apusumit on May 16, 2012 1:46 AM Edited by: apusumit on May 17, 2012 12:08 AM
-
Maximum lifetime for user ticket renewal - where to find this setting on member server?
Hi, we have set a value of 15 days for the GPO setting "Maximum lifetime for user ticket renewal" under kerberos policy on a separate policy linked to domain. The default value on "default domain policy" is 7. RSOP or GPRESULT doesnt show the act
-
Hi The tick box seems to have disappeared from Apps when syncing - just bought a new ipad mini and don't want all my apps on it but without the tick box I'm not sure how to select only the ones I want. Can anyone tell me how I now select only certai