Solved

finding day in month c#

Posted on 2014-10-07
5
88 Views
Last Modified: 2014-10-07
Hi: I have an incremental backup system that runs every day, backing up any files modified in last day. However what I would like to do is, at the beginning of each month, copy absolutely everything from source to backup. Then increment from that. Thus at the start of each month I would have a 'full' backup. Ideally the full backup would run on a saturday so I envisage a line saying  something like 'if today is saturday and not yet  the 7th day of the month, backup everything, else backup incrementally'. I can do all the backup stuff, but stuck on 'day of month'. Can anybody help? Thanks!
0
Comment
Question by:ClaytonGlass
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 50

Expert Comment

by:Rgonzo1971
ID: 40366026
Hi,

pls try

DateSerial(Today.Year, Today.Month, 7)

Today.DayOfWeek

Regards
0
 
LVL 75

Accepted Solution

by:
käµfm³d   👽 earned 500 total points
ID: 40366052
Are you referring to something like:

DateTime now = DateTime.Now;

if (now.DayOfWeek == DayOfWeek.Saturday && now.Day < 7)
{
    // full backup
}
else
{
    // incremental backup
}

Open in new window

0
 

Author Comment

by:ClaytonGlass
ID: 40366063
Ahhh...so Now.Day is day of month, not day of week?
0
 

Author Closing Comment

by:ClaytonGlass
ID: 40366084
Thank you very much! Looks like the way to go!
0
 
LVL 75

Expert Comment

by:käµfm³d 👽
ID: 40366106
so Now.Day is day of month, not day of week?

Yes. You can see that in the Intellisense popup also:

Screenshot
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Article by: Najam
Having new technologies does not mean they will completely replace old components.  Recently I had to create WCF that will be called by VB6 component.  Here I will describe what steps one should follow while doing so, please feel free to post any qu…
This article describes a simple method to resize a control at runtime.  It includes ready-to-use source code and a complete sample demonstration application.  We'll also talk about C# Extension Methods. Introduction In one of my applications…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question