Hàm gmtime convert timer thành thời gian UTC

struct tm *gmtime(const time_t *timer);

Parameter:

timer: con trỏ trỏ tới vùng nhớ lưu trữ thời gian

Remark:

Hàm gmtime( ) convert timer thành thời gian UTC

struct tm chứa thông tin giờ, phút, giây,…

Ví dụ:

#include "stdio.h"
#include "conio.h"
#include "time.h"

void main( void )
{
    time_t ltime;
    struct tm *info;
    time( &ltime );
    info = gmtime( &ltime );
    printf("Current local time and date UTC: %s", asctime(info));

    getch();
}

Kết quả:

Hàm gmtime convert timer thành thời gian UTC
Hàm gmtime convert timer thành thời gian UTC

Be the first to comment

Leave a Reply