Skip to content

Commit ccdec6d

Browse files
Convert date format (#254)
* Create script.js * Create readme.md
1 parent 6c2f863 commit ccdec6d

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Convert date format
2+
3+
**Use-case / Requirement :**
4+
Convert date from one format to another format
5+
For example from dd-mm-yyyy to yyyy-mm-dd or yyyy/mm/dd etc
6+
7+
**Solution :**
8+
Use GlideDate object and getByFormat method for conversion.
9+
Check the script.js file to find the code
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
var gd = new GlideDate(); //Intitialize GlideDate object
2+
gd.setValue('2021-13-10'); //you can pass date for which you need conversion
3+
//Now you can choose the format as required. Below are few examples
4+
gs.info(gd.getByFormat("dd-MM-yyyy"));
5+
gs.info(gd.getByFormat("yyyy/MM/dd"));
6+
gs.info(gd.getByFormat("dd/MM/yyyy"));

0 commit comments

Comments
 (0)