Click to See Complete Forum and Search --> : how can i convert DateTime value to string in C++


chethanJasi
February 27th, 2008, 04:01 AM
//this is my demo program

using namespace System;
using namespace System::IO;

void main()
{
DateTime dt = Directory::GetLastWriteTime( "C:\\debug.log" );

//char str[] = (char)dt;
string strTemp;
}

i want to convert the dt value to a string,
i tried converting to char array it failed.

pls do help me.

Thanks in Advance

darwen
February 27th, 2008, 04:57 PM
If you look at the member functions of DateTime you'll see a lot of 'ToString' methods.

Or you can just do :


string strTemp = dt.ToString();


Darwen.