473,657 Members | 2,409 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

using system date calculate last 6 days in c language

13 New Member
i am in big problem
Under unix C Language
i want return date format like MM/DD/YYYY
this function should return above format .

using system date calculate last 6 days mean clearly i am explain

today date is :06/09/2008

the function return 06/03/2008

but when we write program automatic return the last 6 days date means 06/03/2008


please help .............

bye
madhu
Jun 9 '08 #1
20 3602
gpraghuram
1,275 Recognized Expert Top Contributor
You should use clock tick to do this.
What code u have written for this?

Raghu
Jun 9 '08 #2
madhu3437
13 New Member
using c language (unix)

return should this format mm/dd/yyyy

calculate the last 6 days mean
using system date - 7 days so we get the last 6 days
there is no input here automatically get the return the function of last 6 days date
please help ,......
i want source code for this

please please


thanks
madhu







You should use clock tick to do this.
What code u have written for this?

Raghu
Jun 9 '08 #3
JosAH
11,448 Recognized Expert MVP
On your unix/linux/whatever system type in 'man ctime' and read all about it.

kind regards,

Jos
Jun 9 '08 #4
gpraghuram
1,275 Recognized Expert Top Contributor
We cant write code for you.
The logic u are asking is to some extent simple.
You should use localtime() and time() functions for this

Raghu
Jun 10 '08 #5
madhu3437
13 New Member
i am little bit confusion , code please help,


Regards,
Madhu



We cant write code for you.
The logic u are asking is to some extent simple.
You should use localtime() and time() functions for this

Raghu
Jun 10 '08 #6
madhu3437
13 New Member
i tryied below code........... ......

#include <time.h>
#include <stdio.h>

int main()
{

time_t current,c6;

current = time(NULL);
c6 = current - (6 * 3600 *24);
printf("\n Current Time : [%s]", ctime(&current) );
printf("\n 6 Days before : [%s]", ctime(&c6));

return 0;
}

output give the last 6 days date


but using this code write the function and return the last 6 days date..

please help.......
Regards,
Madhu





i am little bit confusion , code please help,


Regards,
Madhu
Jun 10 '08 #7
JosAH
11,448 Recognized Expert MVP
but using this code write the function and return the last 6 days date..

please help.......
I'm sorry I don't understand your question. You have working code that produces
the correct output using the correct logic. What exactly do you want? I'm afraid
this is a little English language problem.

kind regards,

Jos
Jun 10 '08 #8
madhu3437
13 New Member
#include<stdio. h>
#include<time.h >
char *functionName() ;
int main()
{
printf("\n date - 6 days : [%s]" , functionName()) ;
//Here u will get in full string format then u parce it and use the info what ever required.
}

char *functionName()
{
current = time(NULL);
c6 = current - (29 * 3600 *24);
return ctime(&c6);
}

output is ::::::::::::::
date - 6 days : [Wed Jun 4 17:09:40 2008]


i write the above code it returns the last 6 days date
so output convert into MM/DD/YYYY [06/04/2008]
please help ..............h elp

Regards,
Madhu





I'm sorry I don't understand your question. You have working code that produces
the correct output using the correct logic. What exactly do you want? I'm afraid
this is a little English language problem.

kind regards,

Jos
Jun 10 '08 #9
JosAH
11,448 Recognized Expert MVP
I'm sorry, I still don't understand what you want. I've asked the other moderators
to have a peek; maybe one of them can help you out.

kind regards,

Jos
Jun 10 '08 #10

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

Similar topics

4
2998
by: Lynn | last post by:
On a form I have Date_Start Date_End I have a new Date_Start1 Date_End1 which the use inputs. I need to validate that Date_Start1 and Date_End1 are a date range entirely separate from Date_Start and Date_End i.e. no overlapping
4
5364
by: Richard Hollenbeck | last post by:
I'm trying to write some code that will convert any of the most popular standard date formats twice in to something like "dd Mmm yyyy" (i.e. 08 Jan 1908) and compare the first with the second and calculate days, months, and years. This is not for a college course. It's for my own personal genealogy website. I'm stumped about the code. I'm working on it but not making much progress. Is there any free code available anywhere? I know it...
7
15488
by: Adrian | last post by:
I hit on this problem converting a VB.NET insurance application to C#. Age next birthday calculated from date of birth is often needed in insurance premium calculations. Originally done using DateDiff in VB.NET which is only available in C# if you don't mind linking in Microsoft.VisualBasic.dll to your C# application. I wanted to avoid this so set about a pure C# solution which uses a combination of TimeSpan in whole days and the...
9
2412
by: mistral | last post by:
Need help to remove list of days from date script. Need format "June 07, 2006" <SCRIPT LANGUAGE="JavaScript"> <!-- Begin // Get today's current date. var now = new Date();
3
2047
by: Stephen | last post by:
Hi, I have a table consists which cosists of batch numbers, and assosiated dates and times..ie the columns are batch, date and time. The data within the table is not in any particular order. With a report, I need to calculate and display the difference in date / times between like batch numbers, ie displaying batch number, start date & time, finish date & time and duration
0
1521
by: kumarkanth | last post by:
My question is how do I manipulate the procedure to calculate cut-off date with in working days and it should skip weekends and holidays? I have holiday table to determine holidays Table Name : HOLIDAYMSTR HOLIDAYMSTR_ID RAW(16) PREV_UPDATED_BY RAW(16) Y LAST_UPDATED_BY RAW(16) HOLIDAY_DATE DATE ...
10
12437
by: dan | last post by:
Am i breaking any rules when I loop dates like // Determine Memorial Day intFlag = 0; memDayHol = new Date (currentYear, 4, 31); while (intFlag == 0) { if (memDayHol.getDay() == 1) {intFlag =1;} else {memDayHol = memDayHol - 1;} }
11
2504
by: Connie via AccessMonster.com | last post by:
Hi Access Building Friends, I am building a database for a manufacturer who needs to know the projected End_Date of each job. I know the Start_Date and the total days required to do the job. I need to calculate the End_Date after taking into account Weekends and Holidays.
1
3440
by: swethak | last post by:
hi, i have a code to disply the calendar and add events to that. It works fine.But my requirement is to i have to disply a weekly and daily calendar.Any body plz suggest that what modifications i have to made in my code <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type"...
0
8395
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8310
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8826
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8732
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8605
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7330
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6166
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4306
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1615
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.