Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static string DateCalc(int mode) {
- string DTmonth;
- string DTday;
- string DThour;
- string DTmin;
- string DTsec;
- string Date;
- if (DateTime.Now.Month.ToString().Length == 1)
- {
- DTmonth = "0" + DateTime.Now.Month;
- }
- else { DTmonth = DateTime.Now.Month.ToString(); }
- if (DateTime.Now.Day.ToString().Length == 1)
- {
- DTday = "0" + DateTime.Now.Day.ToString();
- }
- else { DTday = DateTime.Now.Day.ToString(); }
- if (DateTime.Now.Hour.ToString().Length == 1)
- {
- DThour = "0" + DateTime.Now.Hour.ToString();
- }
- else { DThour = DateTime.Now.Hour.ToString(); }
- if (DateTime.Now.Minute.ToString().Length == 1)
- {
- DTmin = "0" + DateTime.Now.Minute.ToString();
- }
- else { DTmin = DateTime.Now.Minute.ToString(); }
- if (DateTime.Now.Second.ToString().Length == 1)
- {
- DTsec = "0" + DateTime.Now.Second.ToString();
- }
- else { DTsec = DateTime.Now.Second.ToString(); }
- if (mode == 1)
- {
- Date = DateTime.Now.Year + "." + DTmonth + "." + DTday + " " + DThour + ":" + DTmin + ":" + DTsec;
- }
- else { Date = DateTime.Now.Year + "." + DTmonth + "." + DTday + " " + DThour + "-" + DTmin + "-" + DTsec; }
- return Date;
- }
Advertisement
Add Comment
Please, Sign In to add comment