Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,959 questions

51,901 answers

573 users

How to convert days into human-readable weeks and days in VB.NET

2 Answers

0 votes
Imports System

Public Class Program
	Public Shared Sub Main()
        Dim days As Integer = 26
		
        Dim str As String = String.Format("{0} Weeks, {1} days", days \ 7, days Mod 7)
		
        Console.WriteLine(str)
    End Sub
End Class
  
    
    
' run:
'
' 3 Weeks, 5 days
'

 



answered Jun 25, 2024 by avibootz
0 votes
Imports System

Module Program

    Public Function ToReadableWeeksDays(totalDays As Integer) As String
        Dim weeks As Integer = totalDays \ 7
        Dim days As Integer = totalDays Mod 7

        Return $"{weeks} week{If(weeks = 1, "", "s")} and {days} day{If(days = 1, "", "s")}"
    End Function

    Sub Main()
        Dim days As Integer = 26

        Console.WriteLine(ToReadableWeeksDays(days))
    End Sub

End Module



' run:
' 
' 3 weeks and 5 days
' 

 



answered Dec 31, 2025 by avibootz

Related questions

...