spot7.org logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML Categories

Obtaining String in the format of DD-MON-YY from date


Use SimpleDateFormat:

SimpleDateFormat sdf = new
SimpleDateFormat("dd-MMM-yy");
String s = sdf.format(gc.getTime());
System.out.println(s);

This is the part in the javadoc you were looking for:

Letter    Date or Time Component       
     Presentation      Examples
  M       Month in year (context sensitive)     
Month      July; Jul; 07

Month: If the number of pattern letters is 3 or more, the month is interpreted as text; otherwise, it is interpreted as a number.

  • Letter M produces context-sensitive month names, such as the embedded form of names. If a DateFormatSymbols has been set explicitly with constructor SimpleDateFormat(String, DateFormatSymbols) or method setDateFormatSymbols(DateFormatSymbols), the month names given by the DateFormatSymbols are used.
  • Letter L produces the standalone form of month names.

Categories : Java

Related to : Obtaining String in the format of DD-MON-YY from date
Parsing JSON of format Map> in android
As you are new to JSON you may want to use GSON library. TO do that add to yuor dependencies in build.gradle and sync compile 'com.google.code.gson:gson:2.3' Supposing json contains your JSON string you can use it like this: import java.lang.reflect.Type; import com.google.gson.Gson; import com.google.gson.reflect.TypeToken; // (...) Gson gson = new Gson(); Type type = new TypeToken<Map&l

Categories : Android
How Can i know if a string is on MD5 format
option 1: Dim reg = New RegularExpressions.Regex("[0-9a-f]{32}", RegularExpressions.RegexOptions.Compiled) Function LooksMd5(str As String) As Boolean Return reg.IsMatch(str) End Function option2 (check and get bytes in one step - try parse string to bytes array) Function TryParseHex32(str As String, ByRef result As Byte()) As Boolean If str.Length <> 32 Then Return False Re

Categories : Vb.Net
Trying to pass a String with a certain format
[{"blah.png"},{"blah2.png"}] Would not be valid JavaScript or JSON. If you wanted to use objects instead of strings, your loop would look more like this $('#fileList .files .fileName').each(function () { var name = $(this).text(); filesObj.push({"name": name}); }); Here, each object has a key, "name", and a value that corresponds to $(this).text();

Categories : Jquery
How to use Format String Attack
First of all I recommend that you read the book Hacking: The Art of Exploitation. It is very good. Now I try to explain how you can exploit your program. I assume that you know some basics about Format String Exploits, so I don't have to start from the very beginning. However it is important to disable ASLR and compile the executable without stack protection. # disable ASLR @> echo 0 | sudo t

Categories : C
How to build string in xml format using Xquery or XSLT
When you define your XQUERY, I think that root element 'x' have no namespace. However, I can see above that you have associated it with namespace "http://ws.apache.org/ns/synapse" : remove it and try again

Categories : Xml
Recently Add
Redirecting the output directory of 'mvn package' or 'mvn compile' command
No suitable constructor found for ProductoExtranjero
java Composite design pattern(Directory &File)
Java JTree's ui refresh after removing node from parent
First REST Spring application
How to cancel Indexing of a Solr document using Update Request Processor
PowerMock - Mock a Singleton with a Private Constructor
Calling a Postgres stored function SQL error
Where to store Morphlines Java custom command class?
Generic repository using map
How can I scroll a ScrolledComposited in Eclipse SWT Design view?
2 Frames/layout in 1 Activity
Writing a switch differently
Next button opens another activity when its reaches the array limit
Is EclipseLink MOXy capable of applying JSR-303 Bean Validation when unmarshalling XML to object?
Why my jdk can't work,and before the java_home, there is a space that is not from me
How to add List of objects in a Map
How to make notepad++ function like regular notepad in cmd?
Cell renderer and the lost focus
how can I implement iterable for LinkedList>
Disable Androids image-crunch in eclipse (run as) builds
java 8 lambda myMap.stream().count() != myMap.size() after merging myMap
Issue with Calendar calculation that spans 2 calendar years
JSF 2.0 Spring bean injection
Java Regex ReplaceAll with grouping
Getting any word and last word using sed
Clicking on link on JEditorPane throws IOException
printing out difference of two arrays
Spring Bean Alias in JavaConfig
Using Factory Method to Create Generics
© Copyright 2017 spot7.org Publishing Limited. All rights reserved.