Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn More

View all

Sign in to view all badges

How to programmatically add Date object to crx repo

Avatar

Avatar
Validate 1
Level 1
Harsh161987
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile

Avatar
Validate 1
Level 1
Harsh161987
Level 1

Likes

0 likes

Total Posts

1 post

Correct Reply

0 solutions
Top badges earned
Validate 1
View profile
Harsh161987
Level 1

02-12-2020

HI ,

 

I need to set date type programmatically  in crx repo so that it should work with both classic and touch UI datepicker.

Currently I am setting up as a string "Fri Dec 04 2020 13:08:08 GMT-0700" which is working for classic but not for Touch UI.

I have tried with using SimpleDateFormat (below format) to format string (eg) "2020-12-23T03:15:00.000+05:30"  it as date object but getting as null in crx.

yyyy-MM-dd'T'HH:mm:ss.SSSXXX

 Please let me know how to proceed here.

THanks

Accepted Solutions (1)

Accepted Solutions (1)

Avatar

Avatar
Validate 1
Level 4
Sandeep6
Level 4

Likes

56 likes

Total Posts

66 posts

Correct Reply

15 solutions
Top badges earned
Validate 1
Give Back
Boost 50
Boost 5
Boost 3
View profile

Avatar
Validate 1
Level 4
Sandeep6
Level 4

Likes

56 likes

Total Posts

66 posts

Correct Reply

15 solutions
Top badges earned
Validate 1
Give Back
Boost 50
Boost 5
Boost 3
View profile
Sandeep6
Level 4

02-12-2020

Hi @Harsh161987 ,

 

please use below code to set date property to node.

String dateString = "your_date"
Calendar cal = new GregorianCalendar();
cal.setTimeZone(TimeZone.getDefault());
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSXXX");
cal.setTime(formatter.parse(dateString))
node.setProperty("date", cal );

 

Thanks,

Sandeep.

Answers (1)

Answers (1)

Avatar

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

140 likes

Total Posts

188 posts

Correct Reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile

Avatar
Give Back 3
MVP
Manjunath_K
MVP

Likes

140 likes

Total Posts

188 posts

Correct Reply

61 solutions
Top badges earned
Give Back 3
Give Back
Boost 50
Boost 5
Boost 3
View profile
Manjunath_K
MVP

02-12-2020

Hi @Harsh161987 ,

Can you please share code snippet the way you are setting this date property value.