473,386 Members | 1,796 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Help with writing a program that has to deal with day Number

Im not sure how to do the formula so it will output what day in the year a certain date is. This is what I was planning to do as the calculations, but I could be way off.


if(month > 1)
dayNumber = 31;
else if(month > 2)
dayNumber = 31 + 28;
else if(month > 3)
dayNumber = 31 + 28 + 31;

This is only a part of it. Not sure if this is anywhere near right or not. Any ideas?
Oct 25 '07 #1
1 1036
gpraghuram
1,275 Expert 1GB
Im not sure how to do the formula so it will output what day in the year a certain date is. This is what I was planning to do as the calculations, but I could be way off.


if(month > 1)
dayNumber = 31;
else if(month > 2)
dayNumber = 31 + 28;
else if(month > 3)
dayNumber = 31 + 28 + 31;

This is only a part of it. Not sure if this is anywhere near right or not. Any ideas?
If u are running in Unix try to use date command to get the day
this command gets the day for a specified date
date +%A --date 10/26/2007
date shuld be given in mm/dd/yyyy format
use system command and pass the command as parameter to system command from a c code

Raghuram
Oct 25 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: Simon | last post by:
I am a programming student and have recently missed two weeks of school due to a serious injury in a car accident. I am completing all of my assignments (via Labs) but have come across the...
19
by: Protoman | last post by:
Hi!!! I need to write a program in which the user defines how many params a mean calculating function uses; here's what I have #include <iostream> #include <cstdlib> #include <vector> #include...
8
by: baustin75 | last post by:
Posted: Mon Oct 03, 2005 1:41 pm Post subject: cannot mail() in ie only when debugging in php designer 2005 -------------------------------------------------------------------------------- ...
15
by: honeygrl33 | last post by:
i accidentially erased something someone helped me write and i am soooo in trouble if i dont fix this, i really need the help!!!!! heres what i have: /* */ #include <stdio.h> #include...
27
by: SK | last post by:
Hi I am trying to teach myself how to program in C. I am a physician hoping to be able to help restructure my office. Anyhow, I amhoping that the porblem I am having is simple to those much more...
1
by: Rahul | last post by:
Hi Everybody I have some problem in my script. please help me. This is script file. I have one *.inq file. I want run this script in XML files. But this script errors shows . If u want i am...
36
by: felixnielsen | last post by:
What i really wanna do, is defining my own types, it doesnt really matter why. Anyway, i have run into some problems 1) typedef unsigned short U16; U16 test = 0xffffffff; // There should be a...
15
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to...
0
by: gunimpi | last post by:
http://www.vbforums.com/showthread.php?p=2745431#post2745431 ******************************************************** VB6 OR VBA & Webbrowser DOM Tiny $50 Mini Project Programmer help wanted...
53
by: souporpower | last post by:
Hello All I am trying to activate a link using Jquery. Here is my code; <html> <head> <script type="text/javascript" src="../../resources/js/ jquery-1.2.6.js"</script> <script...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.