Abbreviated timezone names

Does anyone know how to get the abbreviated timezone name in Windows? As i know, the timezone name is based on the name store in the register. But the name is not abbreviated one. I want it to be short form like MYT.

Does anyone could help me? Any way to change it to short name?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
int main()
{
	time_t now;
	struct tm *date;
	char line[1024];
	char buffer[1024];
	struct timeval  gdate;
	
	gettimeofday(&gdate, NULL);
        now = (time_t) gdate.tv_sec;
        date = localtime(&now);

	strftime(buffer,sizeof(buffer),"%D %T %Z",date);
	sprintf(line, "%s\n", buffer);
	printf("\n%s",line);
	

	return 0;
}


Output:
Mon Apr 26 11:00:00 2010 Malay Peninsula Standard Time

Expected result:
Mon Apr 26 11:00:00 2010 MYT

Can i do this?
Last edited on
Topic archived. No new replies allowed.