Solved

Timestamp

Posted on 2007-11-14
4
591 Views
Last Modified: 2012-05-05
Just trying to get a timestamp:

new DateTime().ToString()

is that correct?
0
Comment
Question by:directxBOB
  • 2
4 Comments
 
LVL 23

Expert Comment

by:Ashish Patel
ID: 20279036
string strDate  = DateTime().Now.ToString();

and for both date and time as different do this

string strDate = DateTime.Now.ToShortDateString();
string strTime = DateTime.Now.ToShortTimeString();
0
 

Author Comment

by:directxBOB
ID: 20279065
DateTime().Now

Doesn't appear to exist, what version of ,NET would that be in? I can only use 2.0
0
 
LVL 23

Accepted Solution

by:
Ashish Patel earned 250 total points
ID: 20279092
Try using this.
string strDate  = DateTime.Now.ToString();
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 250 total points
ID: 20279881
Now is a property, not a method, like asvforce stated.

if you want the timestamp as a unique 64-bit value, you can use:
    long ts = DateTime.Now.ToBinary();
or as a string:
   string ts = DateTime.Now.ToBinary().ToString();
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Google Directions API to Map URL -C#? 3 46
Problem to Office 1 40
Problem to copy file 14 45
Web page design problem 3 12
This article introduced a TextBox that supports transparent background.   Introduction TextBox is the most widely used control component in GUI design. Most GUI controls do not support transparent background and more or less do not have the…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

740 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question