❔ Using the DateTime.Now
How do I apply a date for each blog that should have a publication date? https://gist.github.com/Programmer-Faraj/fdc814033943b69af8bdf19a00b83b14
Gist
This is an assignment project from my course
This is an assignment project from my course . GitHub Gist: instantly share code, notes, and snippets.
49 Replies
as a first thing, instead of having all those comments i would use methods
and for example instead of switch case 1 case 2 etc at least i would put constants
because 1 and 2 i don't know what they are
this could be reflected in the menu too, like you could have 1 to save, but you could also write
save
to have a date for the post you should use a data structure like a class instead of string[]
so that you have fields for title, post, and publicated (your date)Thanks a lot for showing up to offer some help! I reviewed what you just mentioned and these tips are very useful for a clean and more readable code.
if you read here you'll get an idea why I did it like this https://discord.com/channels/143867839282020352/169726586931773440/1099652430557356072
Faraj#6089
Guys, I couldn't figure out any solution for this issue. I'm trying store a date generated from into my string list, but it seems like the list should be type https://gist.github.com/Programmer-Faraj/fdc814033943b69af8bdf19a00b83b14
Embed Type
Article
Quoted by
<@!973964186956726313> from #help-0 (click here)
React with ❌ to remove this embed.
I can't use a class but I could use methods
uhm i don't know what would be the part that says you might not use a class or in general data structures
Yeah! I don't know either.
• May I build the structure of the blog around a list containing a class?
No. It may be a "better" structure, as it gives more control, but that is not how the task goes
out on. You must follow the given structure.
_
this is what they say too
the given structure would be the swedish images or something else
which image one do you mean?
the "requirements"
Aha! Sorry, now I get what you mean. Let me show you their original structure, it's in Swedish, but I could translate it.
this is the whole assignment, but you can see at the bottom where it says the Extended functionality
this is what we're dealing with right now
aaaah ok
I hope got a glimpse of the requirements
i would say this is not well formulated
but ok
i would not convert date to string
i would rather keep two synchronized lists
again, this from not having read ⚠️ the faq pdf ⚠️
Really! You mean the structure?
neither we can
I don't really know how the hell I would convert in this context, otherwise converting is so easy, but not here.
so, then?
faq pdf 🤔
are we able to convert in this context?
i'm not sure i'm following
you still mean convert as convert datetime to string?
but why?
Sorry, I said wrong, I've had bad sleep last night.
The error says you can't convert DateTime. System to string, that means we can't.
so you don't want to have two lists one with the posts and one with the date
We could do that of course my friend, I tried it and it works. But here is the issue, the posts will be saved in the string list, and our date will be in a separated list, how am I able to combine the two with each other?
do you get what I mean logically?
items would have the same index in both lists
that's why i used the word synchronized
so post 1 data would have title and content in index 1 in first list and date in index 1 in second list
Ok! Wow, you're awesome man. You have a pretty good deep knowledge. I didn't know that. Happy to learn a new concept everyday 😀
so this is meant by synchronized
I will add what you mentioned in my notes
that's not deep knowledge 😒
Really, for me it looks like it at least 😇
that's why they included this in the image with the assignment.
so I go and implement that
what am I doing wrong here?
why are you using an array of DateTime
inside a list
why I get System.DateTime[] all the time
you're right, it has no meaning what so ever.
you need to use an individual instance of DateTime (.ToString) to get something meaningful
Bingo
It's working now 💪
I haven't practiced DateTime that much that's why I get stuck
its not special aboutDateTime, its a general rule
array/list/dict etc wont automatically print 'nicely'
could you show me one example of what you mentioned?
Ok
you could shorten stuff like
List<DateTime> dateList = new List<DateTime>();
to
var dateList = new List<DateTime>();
or
List<DateTime> dateList = new()
it doesn't seem you are using visual studio, i don't know if this has helpers for string formatting
if you did a datetime_variable.ToString("") when the cursor is inside the "" a popup with the formatting tokens would appearYep, that's right.
bro. The reason why I'm still weak in the c# fundamentals is because I'm using VS (Preview) version on MacBook Air and it has no feature literally nothing.
I'm thinking about purchasing Rider instead, since I waste a ton of times in this dame VS
I would purchase Rider so I could do like debug or use other features and save a ton of time
does it make sense what I just mentioned for you?
I find myself suck so often in the fundamentals because of my dame VS
not really
if paradoxically you did everything in notepad this would force you to learn more stuff
because there would be no automations
still, a good ide to work with is obviously more productive
Oh! Really. So I was wrong in thinking about purchasing Rider. You're right. It makes sense. I guess I waste a lot of time, but at least I'm learning how to solve problems on my own without any automations like you mentioned.
i mean i don't know why you think vs is bad
it's bad in Mac because I can't debug or other features
is notepad considered as an IDE too?
well ok vs on mac is not great
but vs, albeit beng microsoft oriented, has useful features
it's not
Really like what features?
Oh! I thought so.
from the basics features like autocompletion and colorizing, plugins, refactoring (ok in rider it's probably better working), to eventually more advanced stuff like diagrams, performance diagnostics, ia for autocompletion, the visual part if you use forms and such, task list if you use it, and so on
Wow, you have a good enough knowledge in the IDEs how do you know all that? Are you a senior developer or sort of?
Or maybe you've used both editors and gained some knowledge a long the way.
man I got stuck again and I have submit my assignment today, because I'm out of the deadline.
mine was still a generic argument, this is a little more onpoint but still not in depth
https://visualstudio.microsoft.com/vs/compare/
one of the features i like a lot is the remote debugger
Visual Studio
Compare Visual Studio Product Offerings | Visual Studio
Compare Visual Studio 2022 offerings to find the set of tools & resources that's best for you.
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.Not yet
@dontHey man, are you available?
i was at the notary
and now i have to go to work
Aha! Ok! It's totally alright man. Thanks a lot though 😃
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.