Is there a date format to display the day of the week in java?
This should display 'Tue':
new SimpleDateFormat("EEE").format(new Date());
This should display 'Tuesday':
new SimpleDateFormat("EEEE").format(new Date());
This should display 'T':
new SimpleDateFormat("EEEEE").format(new Date());
So your specific example would be:
new SimpleDateFormat("yyyy-MM-EEE").format(new Date());
Format current date to show day of the week
This does what you want
Calendar cal = Calendar.getInstance();
SimpleDateFormat sdf = new SimpleDateFormat("EEE, MMM d, yyyy");
String strDate = sdf.format(cal.getTime());
System.out.println("Current date in String Format: " + strDate);
Where strDate can be displayed in your textView or whatever
excel : format dates so that they include the day of the week in full letters
Right click on the cell - cell formating, then select date on the left pane, and select format type on the right pane.
Or is this a programing question ?
insert day of the week based on YYYY/MM/DD format
If you're using VBA, you need the function Format
:
Dim StartDate As Date
Dim DayOfWeek As Date
Dim i As Integer
mbox = InputBox("Enter Start Date", "Enter Start Date")
If IsDate(mbox) Then
StartDate = CDate(mbox)
For i = 0 To 13
Cells(i + 2, 3) = Format(StartDate + i, "dddd")
Cells(i + 2, 4).Value = StartDate + i
Next i
Else
MsgBox "Please Enter a Date"
End If
If you want the routine to display the 14 days including the day entered, use this loop instead:
For i = 0 To 13
Cells(i + 2, 3) = Format(StartDate + i, "dddd")
Cells(i + 2, 4).Value = StartDate + i
Next i
How do I get the day of week given a date?
Use weekday()
:
>>> import datetime
>>> datetime.datetime.today()
datetime.datetime(2012, 3, 23, 23, 24, 55, 173504)
>>> datetime.datetime.today().weekday()
4
From the documentation:
Return the day of the week as an integer, where Monday is 0 and Sunday is 6.
How to show day of the week + format Date
This code will format calendar object to "Thursday, Feb 20 2014"
SimpleDateFormat format = new SimpleDateFormat("cccc, MMM dd yyyy");
String formatDate = format.format(cal.getTime());
See SimpleDateFormat at the official Android docs for more information.
Related Topics
Autoincrement Fields on Databases Without Autoincrement Field
Creating a Composite Foreign Key in SQL Server 2008
SQL Server 2008 Express Concat() Doesn't Exist
"Ora-01438: Value Larger Than Specified Precision Allowed for This Column" When Inserting 3
Using Dynamic SQL to Specify a Column Name by Adding a Variable to Simple SQL Query
Check Constraint on Date of Birth
Rails Active Query Order by Multiple Values in Specific Order
Using of Rownum Function with ">" Sign in Oracle
Create a One to Many Relationship Using SQL Server
SQL Server Clustered Index - Order of Index Question
How to Find the Number of Occurrences of a Particular Character in a String Using SQL
Sql:Using Group by and Max on Multiple Columns
Add Emoji/Emoticon to SQL Server Table
How to Set the Default Schema of a Database in SQL Server 2005
Unique Constraint on Combination of Two Columns
Split a Single Column of Data with Comma Delimiters into Multiple Columns in Ssis
How to Convert Timestamp with Milliseconds to Date in Oracle