daily pastebin goal
0%
SHARE
TWEET

Untitled

a guest Feb 21st, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Nullable!DateTime string2dateTime(in string s)
  2. {
  3.     Nullable!DateTime nret;
  4.  
  5.     if(s.length != "01.01.2018 00:00:00".length) // date like "30.11.-0001 00:00:00"
  6.         return nret; // unknown date
  7.  
  8.     DateTime r;
  9.     r.date = Date(
  10.         s[6 .. 10].to!short,
  11.         s[3 .. 5].to!ubyte,
  12.         s[0 .. 2].to!ubyte
  13.     );
  14.     r.timeOfDay = TimeOfDay.fromISOExtString(s[11 .. 19]);
  15.  
  16.     nret = r;
  17.  
  18.     return nret;
  19. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top