int ExampleInt = (int)3.14159265359; //3.14159265359 is a double but because we casted it to an int it was rounded off to 3
struct ForumDateTime { //just something I grabbed out of my API
string datetime;
string Date;
string Time;
int day;
int month;
int year;
public static explicit operator DateTime(ForumDateTime forumdatetime) { //changed it to explicit
return DateTime.Parse(forumdatetime.datetime); //So I felt like a bit of an idiot here since DateTime already has a parse method and works perfectly fine, but oh well.
}
public ForumDateTime(string s) {
datetime = s;
Date = s.Split(", ")[0];
Time = s.Split(", ")[1];
day = int.Parse(Date.Find("(*)-(*)-(*)")[0]); //incase you're curious what these (*)'s are they're character deliminators. anyone that matches what's to the left and right AND has the specified delimiter in the middle of it will be returned.
month = int.Parse(Date.Find("(*)-(*)-(*)")[1]);
year = int.Parse(Date.Find("(*)-(*)-(*)")[2]);
}
}
DateTime ExampleDateTime = (DateTime)new ForumDateTime("09-23-2015, 01:38 AM");
Copyright © 2026, NextGenUpdate.
All Rights Reserved.