?
Solved

Timestamp

Posted on 2007-11-14
4
Medium Priority
?
606 Views
Last Modified: 2012-05-05
Just trying to get a timestamp:

new DateTime().ToString()

is that correct?
0
Comment
Question by:directxBOB
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 1000 total points
ID: 20279092
Try using this.
string strDate  = DateTime.Now.ToString();
0
 
LVL 55

Assisted Solution

by:Jaime Olivares
Jaime Olivares earned 1000 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

Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Entity Framework is a powerful tool to help you interact with the DataBase but still doesn't help much when we have a Stored Procedure that returns more than one resultset. The solution takes some of out-of-the-box thinking; read on!
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
Suggested Courses
Course of the Month15 days, 15 hours left to enroll

743 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