GreenLake Administration
Operating System - HP-UX
1844251
Members
2943
Online
110230
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-02-2004 06:27 AM
06-02-2004 06:27 AM
strptime
Having problem with %U format for the function strptime. It just don't work. Here is my sample code:
#include
#include
int main()
{
struct tm t;
if(strptime("2004:22","%Y:%U",&t) == NULL)
printf("NULL return\n");
printf("dato=%d%d%d\n",
t.tm_year+1900,t.tm_mon,t.tm_mday);
}
It looks like everything else I do try work, but to convert a year and week number to a date is just not working. (The NULL printf is not written, the value is just set to 0 ) I have also tested %W with the same result.
If you have an idea - please help
Espen
#include
#include
int main()
{
struct tm t;
if(strptime("2004:22","%Y:%U",&t) == NULL)
printf("NULL return\n");
printf("dato=%d%d%d\n",
t.tm_year+1900,t.tm_mon,t.tm_mday);
}
It looks like everything else I do try work, but to convert a year and week number to a date is just not working. (The NULL printf is not written, the value is just set to 0 ) I have also tested %W with the same result.
If you have an idea - please help
Espen
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2007 08:25 AM
08-27-2007 08:25 AM
Re: strptime
It appears that strptime(3) doesn't process %U, unless %w or %a/%A is also there. I don't see such restriction in the Posix standard, so it appears this is a bug.
Also, your test program should clear out your struct tm before calling strptime(3). And your printf should increment tm_mon and have 2 digit day and month:
printf("dato=%d-%02d-%02d\n", t.tm_year+1900, t.tm_mon+1, t.tm_mday);
Also, your test program should clear out your struct tm before calling strptime(3). And your printf should increment tm_mon and have 2 digit day and month:
printf("dato=%d-%02d-%02d\n", t.tm_year+1900, t.tm_mon+1, t.tm_mday);
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP