473,386 Members | 1,715 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.

getdate...

Hi all,
Someone can help me ?

[code]

char compete[FIELD_LENGTH]; //20 char

compete contain a 'date value' returned from oracle procedure (Pro*C)and
you can imagine his value, for example,"01/01/2005"

After i call

strcpy(compete,FormattaData(compete,"%Y%m"));

Now compete value is "2005-01-01"

char *FormattaData(char*datak, char *format)
{
static struct tm *tm;
static char buf[20];
char messaggio[200];
char messtail[100];

memset(buf,'\0',sizeof(buf));

if((tm = getdate(datak))== NULL)
{
CreaPattern(messaggio);
sprintf(messtail," Forse manca la stringa di decodifica in
getdate.template %s \n",datak);
strcat(messaggio,messtail);
ScriviLogFile(messaggio,0);
sprintf(buf,"");
}
else
{
strftime(buf,sizeof(buf),format,tm);
}

buf[19] = '\0';

return buf;
}

I don't wont to use getdate() because this function get info from a
template used to parse and interpret the input string. The templates are
contained in a text file identified by the environment variable DATEMSK,
and my
application run very slowly each time i call her

Someone can help me ?

Thanks a lot..
Nov 14 '05 #1
1 3434
On Thu, 17 Feb 2005 14:14:51 -0500, lasek wrote:
Hi all,
Someone can help me ?

[code]

char compete[FIELD_LENGTH]; //20 char

compete contain a 'date value' returned from oracle procedure (Pro*C)and
you can imagine his value, for example,"01/01/2005"
If you want to convert a string like that with a well-defined format into
a struct tm you could use sscanf().
After i call

strcpy(compete,FormattaData(compete,"%Y%m"));

Now compete value is "2005-01-01"


Your format string didn't include the day of the month.

Lawrence
Nov 14 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Spare Brain | last post by:
Hi, I am observing a strange error with the time portion of the java.sql.Date() when using resultSet.getDate() - it always seems to show 12:00:00. The following code prints 2004-10-27...
5
by: Rajesh Garg | last post by:
Hi, I have written a stored proc with some temporary tables and also used a getdate() in my stored proc. When i try to call the sproc the error is that we can only use extended sprocs or function...
2
by: Konstantin Zakharenko | last post by:
Hello, Our QA team have running a lot of test scripts (for automated regression testing), they run them on the different databases (Oracle/MS SQL). Several of those tests are dependent on the...
2
by: kai | last post by:
Hi, All On Northwind database in SQL Server 2000, I try to setup default value at table design windows for "OrderDate" using GETDATE(), but it does not work. How do I use setup GETDATE default...
10
by: Bill Edwards | last post by:
I'm trying to produce an array of working days but want to force Saturday and Sunday to return the date of the previous Friday, e.g. Sunday 9/12/04 should return Friday 9/10/04 and similarly...
4
by: jim_geissman | last post by:
According to MS, GetLocalTime() (in C++) is only accurate to approx a second, even though it reports milliseconds, and calling it twice and computing the interval can on occasion lead to a...
6
by: Matik | last post by:
Hi, I have a funny situation. Within: MSSQL 2000 SP3, everything below described is running on same PC. there is a program running, which sends information to two other programs. This...
6
by: FFMG | last post by:
Hi, My timezone is GMT +2 So when I do a $date = getdate( 0 ); I get: $date = {
1
by: napjohn8 | last post by:
here is my question with getdate function --12. List the names and staff number for staff who manage detached properties that have a current lease i.e. there is a lease and its end date is in the...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
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
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
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,...
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,...

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.