1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Change the Date format in C

Discussion in 'C' started by Poonamol, Apr 30, 2010.

  1. Poonamol

    Poonamol New Member

    Joined:
    Mar 31, 2010
    Messages:
    33
    Likes Received:
    0
    Trophy Points:
    0
    Hi,

    Input date is in mm/dd/yyyy format and I want to write a function to change the date format in yyyy-mm-dd format.

    Thanks in advance.
     
  2. satyedra pal

    satyedra pal New Member

    Joined:
    Mar 26, 2010
    Messages:
    93
    Likes Received:
    1
    Trophy Points:
    0
    Code:
    For finding the format of date and time with different form,then we can use the following code:
    
     #include<Windows.h>
     
    #include<stdio.h>
    
     void main()
    {
    	SYSTEMTIME var_t;
    	
            GetSystemTime(&var_t);
    	 
               printf("%d\t:%d\t:%d\t:%d\t:%d\t:% d\t"	,var_t.wYear,var_t.wMonth,var_t.wDay
     	,var_t.wHour,var_t.wMinute,var_t.wSecond);
    
    }
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,012
    Likes Received:
    203
    Trophy Points:
    0
    Occupation:
    Senior Support Engineer
    Location:
    England
    How far have you got and where are you stuck? This is *really easy* to do. This is not a free homework service; you must show your work and we will help you get unstuck. But I'm surprised you could be stuck with this; it's just a case of rearranging the string, so have you even tried?
     

Share This Page