Operating System - Microsoft
cancel
Showing results for 
Search instead for 
Did you mean: 

Trying to save datetime string.

ZChauhan
Occasional Contributor

Trying to save datetime string.

Using .Net protocol.
C#

I am trying to get system date&time and save it in a string. here is my syntax



DateTime date3 = DateTime.Now; //this capture current system date.


lr.log(date3.ToString()); // this is printing out the current date and time.


lr.save_string(lr.log(date3.ToString()),"mydate" );
// its not working, I am trying to put the current time & date in a string mydate. its giving syntax error. Cant figure out what.



lr.save_string(lr.log(date3.ToString()}"), "mydate" );

2 REPLIES
James R. Ferguson
Acclaimed Contributor

Re: Trying to save datetime string.

Hi:

Since this is a Microsoft product, you would probably get better answers by posting in the Microsoft family of the ITRC forums.

Regards!

...JRF...
Jon Finley
Honored Contributor

Re: Trying to save datetime string.

http://msdn.microsoft.com/en-us/library/az4se3k1.aspx

The MS example would convert to:

DateTime date3 = DateTime.Now;
DTString = date3.ToString("g");

Jon
"Do or do not. There is no try!" - Yoda